-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Accessibility: Consolidate the focusOnOpen behavior in the withFocusReturn Higher Order Component #4566
Conversation
…eturn Higher Order Component
@youknowriad thanks. I think it makes perfectly sense for components like modals, dropdown menus, etc. that are not mounted initially. Not sure it works well for the Publish Panel and the Sidebar. 1 Worth noting that, depending on the workflow, this button can also be disabled so, regardless of the above, it won't be focusable. 2 I click the X and focus is moved back to the document root. I'd expect it to move back to the "cog" button. 3 Overall, for the Sidebar and Publish Panel, I think we can't solve the interaction issues with code. The root cause of the problem is in the interface and it should be solved re-thinking the interface. |
So your saying, it's ok to handle the Noting that the sidebar already had the |
What if we opened the sidebar using the block settings menu? A sidebar can be opened from several places, so its placement in the DOM shouldn't be relative to a toggle IMO |
It depends on the component it will be used with. Modals and dropdown and similar always need to get focus on the first tabbable and return focus on the "opener" when closed. So if withFocusReturn is going to always do the two things, then its usage should be limited to only some types of interactions. Instead, if we want a more generic component, maybe this could be a "focus manager" with different methods that can be used individually? Worth noting there's still one important piece about focus management that's missing as a generic implementation: constraining tabbing within a component. If I'm not wrong, it is implemented in some specific components but there's no generic
Yep I know, and If I'm not wrong yesterday focus was moved back correctly? maybe something changed in the last hours. |
Not sure what are the actionable items in the PR here. Talking about this particular HoC and not other accessibility utilities. |
I still think we should consolidate |
I noticed that each time we want to use
withFocusReturn
HoC. Having afocusOnOpen
behavior makes sense. While this was made possible with thePopover
component right now, we use thewithFocusReturn
in other places thanPopovers
.In this PR I moved the
focusOnOpen
behavior from thePopover
component to thewithFocusReturn
HoC. It might make sense to rename this HoC, ideas?I also I'm applying
withFocusReturn
to the publish panel partially fixing #4187