-
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
Inserter: Autofocus the Search input #1187
Conversation
cc @mtias and @jasmussen for review |
This works great for me but I wondering if there're accessibility issues with this. Not totally related: We should select the first block automatically and allow "type type + enter" to add the first selected block. |
We chatted with @afercia again today and we can autofocus if we move the search input to the top. If you think that will be a better experience, feel free to change to that, otherwise 👍 from me. |
6e331af
to
eda4e9e
Compare
With the search input moved, we may also need to update this logic, which assumed that the search input would appear at the end of the inserter when keyboarding through the set: https://github.com/WordPress/gutenberg/blob/19ecc2c/editor/inserter/menu.js#L92-L93 |
Should we change the logic here and just use the |
@aduth indeed. Will update this. Thanks! @youknowriad I think you're right. Autofocus was accepted if we moved the search input to the top |
@oskosk can you rebase this so there are no conflicts? |
19ecc2c
to
f8bfc1e
Compare
This allows us to be able to focus the search input when the user starts typing while following accexxibility recommendations.
f8bfc1e
to
14c36e5
Compare
I've updated this PR (code, description and title) to just introduce the autoFocus prop on the search input and move it to the top of the inserter. Also removed the onKeydown behaviour for focusing the search input when a letter key is pressed. This turned out to be an unexpected behaviour in terms of accessible menu navigation. If pressing letter keys is to be implemented as a control for navigation it's expected that pressing the key, will focus the first item with text starting with that letter as detailed by @afercia's research on menu navigation. |
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.
Such a nice improvement. Ship it 👍
@youknowriad not sure if this is still needed |
@afercia calling |
… the search input
@afercia thanks to your comment I ended up realizing that this state variable was being initialized as |
Thanks @oskosk I see now |
@oskosk Sure, I was just asking a question, not arguing anything. |
Oh, didn't parse it as arguing. I just wanted to bring the observations from #1378 into this convo so you knew I'm aware of those :P |
Makes the inserter menu autofocus on the input search. We can autofocus if the search input is on the top as the first focusable item.
Related to #1064
Testing instructions