-
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
Do not control Nav Link item focus when focus within sidebar control #68044
base: trunk
Are you sure you want to change the base?
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
! isLabelFieldFocused && ( | ||
! isControlFieldFocused && ( |
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.
@ellatrix Is it expected that we need to conditionally render RichText like this to avoid it "stealing" focus?
Size Change: +7 B (0%) Total Size: 1.84 MB
ℹ️ View Unchanged
|
Flaky tests detected in 8bc85d6. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12370769846
|
I believe we can just remove the fallback selectPreviousBlock to fix this instead. #68063 |
What?
Avoids controlling the focus when closing the Link UI if the current focus is within a sidebar control.
Fixes #68035
Why?
Currently on trunk when creating a new Link and then focusing on one of the inspector control sidebar fields focus is "stolen". See the Issue where this is detailed.
This is caused by:
Both Issues overlay and are related.
How?
This PR patches the current problem by extending the state which tracks whether the label field has focus to include all of the inspector control fields. This allows us to disable the
RichText
from rendering and stealing focus if a sidebar field is focused by the user.This PR also adds a conditional which exits early from any focus management logic if the focus is currently within any of the sidebar fields.
I will say that it seems extreme that we need to control the
RichText
in this manner. Moreover, I'd love to understand more about why the fallback to select the previous block is necessary.Testing Instructions
/
in the canvas.Testing Instructions for Keyboard
Screenshots or screencast
Screen.Capture.on.2024-12-17.at.10-08-34.mp4