-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 tabbing from first or last block in site editor #42036
Fix tabbing from first or last block in site editor #42036
Conversation
Size Change: +1 B (0%) Total Size: 1.25 MB
ℹ️ View Unchanged
|
4440fe0
to
6528693
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this @talldan 👍
As simple as the fix is, it looks like it fits with the logic of isFormElement
and resolves the issue.
✅ Could replicate the original issue
✅ All E2Es pass locally
✅ Manual tests were successful following PR instructions
✅ Problem is resolved when using this branch
LGTM 🚢
Thanks @talldan ! |
What?
Fixes #41811
Shift tabbing from the first block to the toolbar and tabbing from the last block to the inspector both seem to be broken in the site editor. This PR restores the expected behavior.
Why?
From what I can tell this is a side effect of the iframed editor content. The WritingFlow component implements div elements before and after the editor content that are part of the tab order. In the post editor these are focused when tabbing beyond the first/last block boundaries and some logic transfers focus to the toolbar or inspector.
In the site editor, these are outside of the iframe and can't be found by the
tabbable
utility. That results inundefined
being passed toisFormElement
, which threw an error, and resulted in the code after that point that handles toolbar/inspector navigation not executing.How?
The fix seems as simple as making
isFormElement
returnfalse
when passedundefined
. This seems ok as it matches what other similar utilities in the@wordpress/dom
package do.Testing Instructions
E2E tests have been added
Screenshots or screencast
My screencast app was quarantined as malware. 😭