Existing tutorial is based on the use: directive.
https://svelte.dev/tutorial/svelte/actions
<div class="menu" use:trapFocus>
This should be updated to @attach:
https://svelte.dev/docs/svelte/use
In Svelte 5.29 and newer, consider using attachments instead, as they are more flexible and composable.