Skip to content

Wrap navigation events in withSyncEvent HOC to allow preventDefault - #51

Merged
roborourke merged 1 commit into
mainfrom
use-with-sync-event
Aug 31, 2026
Merged

roborourke merged 1 commit into
mainfrom
use-with-sync-event

Conversation

@goldenapples

Copy link
Copy Markdown
Contributor

Since WP 6.8, calling event.preventDefault() inside of an Interactivity API router is deprecated and unpredictable. In order to use a link inside an interactive router and prevent its default behavior, we have to wrap the handler in the wp.interactivity.withSyncEvent HOC.

See #49.

Since WP 6.8, calling event.preventDefault inside of an Interactivity
API router is deprecated and unpredictable. In order to use a link
inside an interactive router and prevent its default behavior, we have
to wrap the handler in the wp.interactivity.withSyncEvent HOC.

@roborourke roborourke left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @goldenapples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants