-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix iframe event bubbling #55001
Fix iframe event bubbling #55001
Conversation
Size Change: +19 B (0%) Total Size: 1.62 MB
ℹ️ View Unchanged
|
Flaky tests detected in 5d66953. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6391138795
|
Looks like the fix is not good (see e2e test failures) |
Ok, this is definitely not the right fix 🤔 |
What?
In #54080 we changed how we capture keyboard shortcuts and in doing so we added keydown events bubbling to the editor iframe component.
One side effect I noticed was that in "playground" in storybook, when typing in the editor, typed characters conflicted with Storybook shortcuts. The weird thing is that even if there were no iframe used (so events are still bubbling on the same window), the conflicts didn't happen. So the issue was in the way we generated the "virtual" events in the iframe component (since in both with or without iframe, the event was propagated to the parent of the editor).
After multiple checks and attempts, it seems that copying the "bubbles" property (which is supposed to be readonly) when creating the synthetic event is what was triggering the conflict.
Testing Instructions
1- Run storybook locally
npm run storybook:dev
2- Open one of the playground stories
3- Type "s" within the editor, the Storybook sidebar shouldn't be toggling.