Fix the navigate regions focus style#45369
Conversation
|
|
|
Size Change: +1 kB (0%) Total Size: 1.29 MB
ℹ️ View Unchanged
|
5b0b682 to
9f525f2
Compare
|
Rebased on latest trunk after changes for the new theming accent color, see #45289 |
aristath
left a comment
There was a problem hiding this comment.
Code looks good to me, and it fixes the focus issue 👍
| tabIndex="-1" | ||
| { ...motionProps } | ||
| > | ||
| <div className="interface-navigable-region__stacker"> |
There was a problem hiding this comment.
Noting that this may have caused a regression: #45778
A fix could be to set the display + flex direction on this __stacker class, but I'm not familiar enough with the change to be sure.
There was a problem hiding this comment.
I can confirm this. The same is visible in the post editor if a theme has a non-white background.
| @@ -0,0 +1,38 @@ | |||
| # NavigableRegion | |||
There was a problem hiding this comment.
I wonder if this should be moved to the components package insect it's meant to be used in conjunction with useNavigateRegions from that package.
| */ | ||
| import { withPluginContext } from '@wordpress/plugins'; | ||
|
|
||
| export default withPluginContext( ( context, ownProps ) => { |
Fixes #21717
What?
When navigating through the editor regions via the dedicated keyboard shortcuts, the focused region should show a blue outline as focus indicator. This used to work well in #8554 but it's broken since at least 2 years and a half, see #21717
It appears that new layouts and features introduced over time didn't take into consideration the navigable regions need to have a focus style. There are two main issues that make the focus style not visible:
Screenshot to illustrate the z-index issue:
Screenshot to illustrate the 0 size issue (this is the Publish panel toggle button, see there's no focus style on its wrapper region):
The original purpose of these regions is to allow keyboard navigation through the main parts of the editor and show a focus style. They're now also used for layout purposes, as parts of the 'interface skeleton', which is fine. However, it's very important to keep in mind that:
Why?
A clear focus indicator is a basic accessibility requirement for all sighted keyboard users, as they need to see where focus is.
How?
navigateRegionsCSS as we don't need a fix for IE11 any longer. Note: we can't use a CSS pseudo element as suggested in Regression: the navigate region focus style is broken #21717 because the pseudo element would scroll together wit the content.NavigableRegioncomponent to abstract the markup and features of the ARIA regions.NavigableRegionrenders the focusable ARIA landmark region and a child container.z-index: -1so that any content within the region is positioned in the Z-axis at a lower level than the wrapper.navigateRegionsstylesheet.Testing Instructions
Screenshots or screencast
Animated GIF to illustrates the navigate regions focus style in action in the Post editor.