From 8edf0e8900754e214d446fc9f875718ba8b6eb8d Mon Sep 17 00:00:00 2001 From: Tonya Mork Date: Wed, 1 Feb 2023 20:42:23 +0000 Subject: [PATCH] Editor: Add 'wp-polyfill' to _wp_get_iframed_editor_assets() for inert 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: * [https://github.com/WordPress/gutenberg/pull/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 --- src/wp-includes/block-editor.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/block-editor.php b/src/wp-includes/block-editor.php index 4a62837f49..bbb139d756 100644 --- a/src/wp-includes/block-editor.php +++ b/src/wp-includes/block-editor.php @@ -298,7 +298,9 @@ function get_legacy_widget_block_editor_settings() { function _wp_get_iframed_editor_assets() { global $pagenow; - $script_handles = array(); + $script_handles = array( + 'wp-polyfill', + ); $style_handles = array( 'wp-edit-blocks', );