Skip to content
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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/block-editor/src/components/iframe/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ import { store as blockEditorStore } from '../../store';
function bubbleEvent( event, Constructor, frame ) {
const init = {};

const ignoredProperties = [ 'bubbles' ];
for ( const key in event ) {
init[ key ] = event[ key ];
if ( ! ignoredProperties.includes( key ) ) {
init[ key ] = event[ key ];
}
}

if ( event instanceof frame.ownerDocument.defaultView.MouseEvent ) {
const rect = frame.getBoundingClientRect();
init.clientX += rect.left;
Expand Down
6 changes: 1 addition & 5 deletions storybook/stories/playground/box/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ export default function EditorBox() {
}, [] );

return (
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
<div
className="editor-box"
onKeyDown={ ( event ) => event.stopPropagation() }
>
<div className="editor-box">
<BlockEditorProvider
value={ blocks }
onInput={ updateBlocks }
Expand Down
6 changes: 1 addition & 5 deletions storybook/stories/playground/fullpage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ export default function EditorFullPage() {
} );

return (
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
<div
className="playground"
onKeyDown={ ( event ) => event.stopPropagation() }
>
<div className="playground">
<BlockEditorProvider
value={ blocks }
onInput={ updateBlocks }
Expand Down
6 changes: 1 addition & 5 deletions storybook/stories/playground/with-undo-redo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ export default function EditorWithUndoRedo() {
}, [] );

return (
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
<div
className="editor-with-undo-redo"
onKeyDown={ ( event ) => event.stopPropagation() }
>
<div className="editor-with-undo-redo">
<BlockEditorProvider
value={ value.blocks }
selection={ value.selection }
Expand Down
Loading