-
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
Focus first focusable on Link UI #51105
Conversation
Size Change: -25 B (0%) Total Size: 1.39 MB
ℹ️ View Unchanged
|
This looks good to me, but now we probably need to undo some of the changes to the e2e tests from this PR, since it was assuming the focus on the text input |
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.
@jeryj thank you for the PR.
Just noting that this was specifically introduced to ensure the URL
field was always focused.
Can we check that with this change, the URL
field is always the first focuseable, even if the Text
field is displayed?
Once we've confirmed we can update tests accordingly to explicitly assert that the URL
field is focused and reference this PR in the code.
I'm not sure of all the contexts, but it appears first in the render output, so I think it would have to be the first field. |
82a3862
to
3712fc5
Compare
Test breakages look related to tab order which has likely changes now you changed the focus rules. This is why I've advised Maggie to avoid relying on tab ordering in the tests we are porting to Playwright and instead have a single test which asserts on keyboard navigation. |
25b019b
to
1b446ef
Compare
@jeryj I hope I've fixed the tests here. Ideally we should be able to merge this one. |
* Focus first focusable on Link UI * Fix “should preserve trailing/leading whitespace from linked text in text input” test * Fix “should allow for modification of link text via Link UI” test --------- Co-authored-by: Dave Smith <getdavemail@gmail.com>
What?
Always focus the first focusable element when the Link UI opens
Why?
When something takes focus (like a popover or modal), it should also place focus on the first focusable element. It's an unexpected pattern for it to be placed on the second input.
How?
Instead of guessing the placement of the URL input, always focus the first one (which does happen to be the URL input as of #50957).
Testing Instructions
Screenshots or screencast