Block: Ignore focus if explicitOriginalTarget is not node (Firefox)#5112
Block: Ignore focus if explicitOriginalTarget is not node (Firefox)#5112
Conversation
|
Potentially relevant:
|
youknowriad
left a comment
There was a problem hiding this comment.
I don't understand fully but the issue is fixed for me
|
Noted that an unrelated issue with Firefox remains after these changes: When navigating from a nested block to a non-nested block, the formatting toolbar options are not removed. From what I was able to debug here, it seems the fill is being removed on its own unmount, but the slot is not found and therefore not gutenberg/components/slot-fill/provider.js Lines 88 to 94 in 7a63a8a |
mcsf
left a comment
There was a problem hiding this comment.
This moves us from "nesting is basically broken" to "it works but looks weird", which is apt for an experimental feature in such a large release. 🚢
|
I think we can address Safari separately. |


This pull request seeks to resolve an issue where it is not possible to use the block toolbar for a nested block in Firefox. From what I've surmised, this is related to differing treatment of focus events and focus bubbling between Firefox and other browsers, and in its treatment of retargeting said events. My understanding is that
IgnoreNestedEventsis not effective for preventing the focus event from surfacing to the ancestor block because it is already focused and is instead retargeted.https://developer.mozilla.org/en-US/docs/Web/API/Event/explicitOriginalTarget
These changes detect the presence of this property and ensure that, if present, it is equal to the block node.
Testing instructions:
Verify that you can use the block toolbar, in Firefox and your preferred browser, for nested and non-nested blocks.
Verify that there are no regressions in the behavior of block selection via direct focus. Typically this can be done by tab navigating from one block to the next (e.g. a paragraph to a image placeholder block).