ContextmenuRoot.svelte

Declarations
#

view source

ContextmenuRoot
#

ContextmenuRoot.svelte view source

Touch event handler for tap-then-longpress bypass detection.

This allows users to access the native context menu by performing a tap followed by a longpress/rightclick within a specified time window. The bypass gesture is useful for accessing browser features like text selection or the native context menu when the Fuz contextmenu would normally override it.

Note: preventDefault is not called as we're only observing touch patterns, not intercepting them. The actual bypass happens in on_window_contextmenu.

contextmenu?

The contextmenu prop is not reactive because that's a rare corner case and it's easier to put the contextmenu directly in the context rather than wrapping with a store or other reactivity. If you need to change the contextmenu prop for some reason, use a {#key contextmenu} block: https://svelte.dev/docs#template-syntax-key

optional

open_offset_x?

The number of pixels to offset from the pointer X position when opened. Useful to ensure the first menu item is immediately under the pointer.

type number
optional

open_offset_y?

The number of pixels to offset from the pointer Y position when opened. Useful to ensure the first menu item is immediately under the pointer.

type number
optional

bypass_with_tap_then_longpress?

Whether to detect tap-then-longpress to bypass the Fuz contextmenu. This allows access to the system contextmenu by tapping once then rightclicking/long-pressing. Setting to false disables the gesture.

type boolean
optional

bypass_window?

The number of milliseconds between taps to detect a gesture that bypasses the Fuz contextmenu. Used only when bypass_with_tap_then_longpress is true. If the duration is too long, it'll detect more false positives and interrupt normal usage, but too short and some people will have difficulty performing the gesture.

type number
optional

bypass_move_tolerance?

The number of pixels the pointer can be moved between taps to detect a tap-then-longpress. Used only when bypass_with_tap_then_longpress is true.

type number
optional

scoped?

If true, wraps children with a div and listens to events on it instead of the window.

type boolean
optional

link_entry?

Snippet for rendering link entries. Set to null to disable automatic link detection. Defaults to link_entry_default which renders ContextmenuLinkEntry.

type Snippet<[ComponentProps<typeof ContextmenuLinkEntry>]> | null
optional

text_entry?

Snippet for rendering copy text entries. Set to null to disable automatic copy text detection. Defaults to text_entry_default which renders ContextmenuTextEntry.

type Snippet<[ComponentProps<typeof ContextmenuTextEntry>]> | null
optional

separator_entry?

Snippet for rendering separator entries. Set to null to disable automatic separator rendering. Defaults to separator_entry_default which renders ContextmenuSeparator.

type Snippet<[ComponentProps<typeof ContextmenuSeparator>]> | null
optional

children

type Snippet

Depends on
#