From 5d66953e021ba3b14860e4b88ed7d0c0844c774e Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Tue, 3 Oct 2023 10:21:03 +0100 Subject: [PATCH] Fix iframe event bubbling --- packages/block-editor/src/components/iframe/index.js | 6 ++++-- storybook/stories/playground/box/index.js | 6 +----- storybook/stories/playground/fullpage/index.js | 6 +----- storybook/stories/playground/with-undo-redo/index.js | 6 +----- 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/packages/block-editor/src/components/iframe/index.js b/packages/block-editor/src/components/iframe/index.js index 9a6371dcaf425..11b4ab94347dc 100644 --- a/packages/block-editor/src/components/iframe/index.js +++ b/packages/block-editor/src/components/iframe/index.js @@ -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; diff --git a/storybook/stories/playground/box/index.js b/storybook/stories/playground/box/index.js index 444b7810e5e89..a0a3910a1e6ff 100644 --- a/storybook/stories/playground/box/index.js +++ b/storybook/stories/playground/box/index.js @@ -23,11 +23,7 @@ export default function EditorBox() { }, [] ); return ( - // eslint-disable-next-line jsx-a11y/no-static-element-interactions -
event.stopPropagation() } - > +
event.stopPropagation() } - > +
event.stopPropagation() } - > +