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

Block Editor: Add inert polyfill to iframe #47398

Merged
merged 1 commit into from
Jan 25, 2023
Merged

Conversation

t-hamano
Copy link
Contributor

Closes: #47190

What?

This PR adds a polyfill script to the iframe to make the inert attribute work correctly in Firefox. This solves the problem, as reported in #47190, that the site editor can operate on the block editor in Firefox even in browse mode.

Why?

The inert attribute is intended to render the element and its sub-tree elements inert, but Firefox doesn't support this attribute. Therefore, a polyfill script has been introduced, but as investigated in this comment, this polyfill doesn't seem to apply to the inert attribute in iframe. In order for the inert attribute to work as intended in Firefox, even within an iframe, we need to inject the script into the iframe as well as the global document.

How?

Added polyfill to script handles for iframes. If this PR is merged, I would like to submit a ticket and PR for backporting to WordPress 6.2 based on #47187.

Testing Instructions

  • Open the site editor in Firefox.
  • Before: You would be able to operate the block even though you are in browse mode.
  • After: Clicking anywhere in the browse area won't do anything unless you switch to edit mode,

@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended Browser Issues Issues or PRs that are related to browser specific problems [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") labels Jan 25, 2023
@t-hamano t-hamano marked this pull request as ready for review January 25, 2023 04:21
@t-hamano t-hamano requested review from youknowriad and ellatrix and removed request for spacedmonkey January 25, 2023 04:21
Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

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

This makes sense to me

@t-hamano t-hamano self-assigned this Jan 25, 2023
@t-hamano t-hamano merged commit de4a160 into trunk Jan 25, 2023
@t-hamano t-hamano deleted the fix/inert-polyfill-iframe branch January 25, 2023 10:30
@github-actions github-actions bot added this to the Gutenberg 15.1 milestone Jan 25, 2023
pento pushed a commit to WordPress/wordpress-develop that referenced this pull request Feb 1, 2023
…t attribute in Firefox.

Adds the polyfill script to the iframe to make the `inert` attribute work correctly in Firefox. This solves the problem that the site editor can operate on the block editor in Firefox even in browse mode.

Why?

The inert attribute is intended to render the element and its sub-tree elements `inert`, but Firefox doesn't support this attribute. For the `inert` attribute to work as intended in Firefox, even within an iframe, the script needs to be injected into the iframe as well as the global document.

References:
* [WordPress/gutenberg#47398 Gutenberg PR 47398].

Follow-up to [53160].

Props wildworks, mamaduka, youknowriad.
Fixes #57552.

git-svn-id: https://develop.svn.wordpress.org/trunk@55181 602fd350-edb4-49c9-b593-d223f7449a82
github-actions bot pushed a commit to gilzow/wordpress-performance that referenced this pull request Feb 1, 2023
…t attribute in Firefox.

Adds the polyfill script to the iframe to make the `inert` attribute work correctly in Firefox. This solves the problem that the site editor can operate on the block editor in Firefox even in browse mode.

Why?

The inert attribute is intended to render the element and its sub-tree elements `inert`, but Firefox doesn't support this attribute. For the `inert` attribute to work as intended in Firefox, even within an iframe, the script needs to be injected into the iframe as well as the global document.

References:
* [WordPress/gutenberg#47398 Gutenberg PR 47398].

Follow-up to [53160].

Props wildworks, mamaduka, youknowriad.
Fixes #57552.
Built from https://develop.svn.wordpress.org/trunk@55181


git-svn-id: https://core.svn.wordpress.org/trunk@54714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Feb 1, 2023
…t attribute in Firefox.

Adds the polyfill script to the iframe to make the `inert` attribute work correctly in Firefox. This solves the problem that the site editor can operate on the block editor in Firefox even in browse mode.

Why?

The inert attribute is intended to render the element and its sub-tree elements `inert`, but Firefox doesn't support this attribute. For the `inert` attribute to work as intended in Firefox, even within an iframe, the script needs to be injected into the iframe as well as the global document.

References:
* [WordPress/gutenberg#47398 Gutenberg PR 47398].

Follow-up to [53160].

Props wildworks, mamaduka, youknowriad.
Fixes #57552.
Built from https://develop.svn.wordpress.org/trunk@55181


git-svn-id: http://core.svn.wordpress.org/trunk@54714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
VenusPR added a commit to VenusPR/Wordpress_Richard that referenced this pull request Mar 9, 2023
…t attribute in Firefox.

Adds the polyfill script to the iframe to make the `inert` attribute work correctly in Firefox. This solves the problem that the site editor can operate on the block editor in Firefox even in browse mode.

Why?

The inert attribute is intended to render the element and its sub-tree elements `inert`, but Firefox doesn't support this attribute. For the `inert` attribute to work as intended in Firefox, even within an iframe, the script needs to be injected into the iframe as well as the global document.

References:
* [WordPress/gutenberg#47398 Gutenberg PR 47398].

Follow-up to [53160].

Props wildworks, mamaduka, youknowriad.
Fixes #57552.
Built from https://develop.svn.wordpress.org/trunk@55181


git-svn-id: http://core.svn.wordpress.org/trunk@54714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Browser Issues Issues or PRs that are related to browser specific problems [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Site Editor: Blocks can be manipulated in browse mode
2 participants