Skip to content

Initial focus#419

Open
breville wants to merge 2 commits intomainfrom
fix-initial-focus
Open

Initial focus#419
breville wants to merge 2 commits intomainfrom
fix-initial-focus

Conversation

@breville
Copy link
Member

@breville breville commented Mar 6, 2026

#411 did great work in enabling a screenreader to read what's shown in the Guide. An interesting side-effect was that the initial call to .focus() was applying the :focus-visible psuedo-class, leading to a white border around the initial Guide for all users, even though subsequent calls to .focus() applied the :focus psuedo-class which didn't.

It turns out we can provide a newer but now fairly-well supported parameter to .focus() to apply the latter behaviour all the time. This way, the white border doesn't show around that initial guide, a return to its original appearance.

@breville breville requested a review from a team March 6, 2026 05:32
@breville breville changed the title Fix initial focus Initial focus Mar 6, 2026
Copy link
Contributor

@hannahbergam hannahbergam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing more research into this! Would you be able to add a screen recording of keyboard nav + screen reader here too for posterity?

@breville
Copy link
Member Author

breville commented Mar 7, 2026

Thanks for doing more research into this! Would you be able to add a screen recording of keyboard nav + screen reader here too for posterity?

Good idea, @hannahbergam. Here is a recording from initial load of a level. I just press Enter a few times to move through the Guide, and then press tab a few times, followed by shift-tab a few times, to find the "Not Fish" and "Fish" buttons. This is Chrome 145 on macOS 26.3 with VoiceOver. My understanding is that the change in this PR doesn't change the existing behavior, only that border appearance.

oceans-voice-over-0.mov

@hannahbergam
Copy link
Contributor

Thanks for doing more research into this! Would you be able to add a screen recording of keyboard nav + screen reader here too for posterity?

Good idea, @hannahbergam. Here is a recording from initial load of a level. I just press Enter a few times to move through the Guide, and then press tab a few times, followed by shift-tab a few times, to find the "Not Fish" and "Fish" buttons. This is Chrome 145 on macOS 26.3 with VoiceOver. My understanding is that the change in this PR doesn't change the existing behavior, only that border appearance.

oceans-voice-over-0.mov

My concern now is that visible focus has been removed entirely, for keyboard and mouse users alike. The focus-visible class is what ensures a component selected via keyboard has a focus outline. In this case that is important because the guide is blocking any other keyboard actions and must be dismissed before moving forward.

@breville
Copy link
Member Author

breville commented Mar 8, 2026

Thanks for doing more research into this! Would you be able to add a screen recording of keyboard nav + screen reader here too for posterity?

Good idea, @hannahbergam. Here is a recording from initial load of a level. I just press Enter a few times to move through the Guide, and then press tab a few times, followed by shift-tab a few times, to find the "Not Fish" and "Fish" buttons. This is Chrome 145 on macOS 26.3 with VoiceOver. My understanding is that the change in this PR doesn't change the existing behavior, only that border appearance.
oceans-voice-over-0.mov

My concern now is that visible focus has been removed entirely, for keyboard and mouse users alike. The focus-visible class is what ensures a component selected via keyboard has a focus outline. In this case that is important because the guide is blocking any other keyboard actions and must be dismissed before moving forward.

Oh, great observation. I dug a little deeper and have begun a slightly different approach in #420. Curious for your thoughts there!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants