-
Notifications
You must be signed in to change notification settings - Fork 50
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(a11y): prevent refocus of textarea on keyboard navigation #254
Conversation
✅ Deploy Preview for stacks-editor ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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 @dancormier for this small fix (see comment in the code - there is a small bug).
We can add a unit test and we should be good to move on with this story.
Sidenote (More a11y issues)
While reviewing this fix I spent a good amount of time reading WAI authoring practices for menu and menubar. I think that what we have now is still not fully accessible.
Here are the issues I understood still affect our implementation:
- When a menu opens, keyboard focus should be placed on the first item (at the moment the focus stays on the menu button)
Tab
andShift + Tab
should NOT move focus amongmenuitem
s instead they should move to the next/previous focusable item which is not amenuitem
and close the menu if it was open.Arrow Up
andArrow Down
should be used instead to loop through themenuitem
s (focus should be trapped)- When
Enter
(and optionallySpace
) is pressed and user is focused on amenuitem
the item should activate and the menu should close (at the moment the menu remains open)
I think we could consider these a11y issues outside the scope of this fix (since they were not in the report). That said I would not be surprised if we will get a follow up report with these issues listed. The minimum we should do is to create a ticket for our backlog and in my opinion we should try to work on that ticket before the enterprise release too to be on the safe side.
What are your thoughts @dancormier?
I am also tagging @AvogadroSG1 for visibility/3rd opinion.
Co-authored-by: Giamir Buoncristiani <[email protected]>
I'll add a unit test and merge it in. It's not perfect, but it accomplishes the stated goal and is an improvement over what we had.
Thank you for this research. I kinda took the ticket/report at face value and "fixed" the issue, but the approach you found in your research makes total sense. When I was working on this, I even had the thought about arrow navigation making sense (I thought it would be nice if it kinda worked like navigating a radio group), but just left it as-is. Out of curiosity (and proximity), I tested out the
For the record, I'm not suggesting we follow GitHub's lead here. I figured I'd mention it as a curiosity here.
I agree. I think we can consider this as accomplishing the goal and resolving the stated issue. There's room for improvement, but this is moving in the right direction. Related, I've yet to see a concrete standard we're being held to by the third-party requesting the fix. The best I've heard is "we need to be able to show we're improving accessibility" which I think this accomplishes. We can prioritize other improvements that get us closer to something like WCAG AA adherence outside of this PR. For now, I'll write up some tickets. Thanks @giamir for the review and all the information! |
Closes STACKS-383
This PR ensures that the focused editor menu element retains focus when navigating via keyboard.
Previously, tabbing to a menu element then invoking it with enter would send focus to the "view" (aka the textarea). This would require those navigating with the keyboard to have to tab back to where they were to continue where they left off. This PR addresses this issue with the following changes:
TODO