-
Notifications
You must be signed in to change notification settings - Fork 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
Gutenboarding: Improve a11y and lints #38583
Conversation
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: App Entrypoints (~5546 bytes added 📈 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~316087 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~46 bytes removed 📉 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
client/landing/gutenboarding/onboarding-block/design-selector/style.scss
Outdated
Show resolved
Hide resolved
😮 Another wild ICFY report❗️ Why would this affect all those sections so badly? |
<Card | ||
className={ classnames( 'design-selector__design-option', { 'is-selected': isSelected } ) } | ||
isElevated | ||
onClick={ onClick } | ||
style={ style } | ||
aria-haspopup="dialog" | ||
aria-controls={ dialogId } |
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.
There's no value in adding those aria attributes if the component is not accessible.
Use Reakit Rover for tab access to designs and templates in the page selector.
I'd not use Rover
here. Rover
will apply the roving tabindex method to the cards, which means that, by default, users won't be able to Tab through the cards. And since they have no clue that they should use arrow keys (as they would with widgets like toolbar, menu etc.), keyboard users may still not be able to navigate through this page.
That could be solved by overwriting the tabIndex
prop rendered by Rover
, which would allow users to Tab and use arrow keys at the same time! 🙌
But that's not the only problem! 😔
Rover
only adds roving tabindex in one dimension. Sighted users using the keyboard could expect that they could navigate the card list as if it were a grid (bidimensional), since that's what they see. There's an ongoing conversation around adding a Grid
module to Reakit: ariakit/ariakit#435
Instead of overcomplicating this, I'd just make this component tabbable.
Tabbable
, which is used by Rover
underneath, may help with this, specially because this component is a div
. Tabbable
would also make it clickable with Enter and Space.
A simpler (and better?) solution though is to just turn this element into a button
. <Card as="button"
should do the trick I guess.
client/landing/gutenboarding/onboarding-block/design-selector/style.scss
Outdated
Show resolved
Hide resolved
@@ -121,6 +129,12 @@ $deisgn-selector-selection-space: 175px; | |||
overflow: hidden; | |||
padding: 2px; | |||
|
|||
&:hover, | |||
&:focus { | |||
border: 3px solid var( --color-neutral-dark ); |
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.
I'm a little surprised by Calypso color variable here instead of Gutenberg variable. Not a blocker for merging, just something we'll likely need to audit at some point.
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.
It's the color used in design and also in the current page template selector. The closest Gutenberg variable would be $dark-gray-600: #40464d;
but it has less blue and more grey.
I agree we need to define together with design team which parts should be using Gutenberg styles and where should come in Calypso theming.
Also we should take into consideration that mixing color variables will increase the complexity of dark theme support ( #38587 )
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.
Lookin' good!
Some notes;
- Couldn't get design picker "selected style" (or the text you mention) visible by mouse nor by keyboard by tabbing or with arrow keys. Tabbing does work, just I don't see visually any indication. Tested on Chrome.
- At page selector, could selected page that I tab into turn darker in color, so that tabbing over selected pages wouldn't seem "invisible"? I'd expect same style when I hover already selected page.
- Scroll position followed nicely tabbed selection in both design picker and page selector
- Once I tabbed to the last page in the grid, I could see designs peaking:
- Esc cancels all page selections and returns to design picker, just like clicking outside page selector does as well. I expected my page selections to remain tho; they got wiped out.
- I can tab-rotate in pages, but I cannot escape them? Should we tab to "back" button, "domain picker" and other elements after the last page in the grid? Good for follow up PR.
ci/wp-desktop failure seems unrelated — rebasing might help. |
&:hover, | ||
&:focus { | ||
border: 3px solid var( --color-neutral-dark ); | ||
padding: 0; | ||
} |
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.
We can borrow from the existing starter page template selector styles - the suggestion below works for page selector cards. Still need to figure out how to work around a specificity collision with .is-elevated
to use the same style on the design selector cards.
&:focus {
box-shadow: 0 0 0 1px $white,
0 0 0 3px $blue-medium-500;
// Windows High Contrast mode will show this outline, but not the box-shadow.
outline: 2px solid transparent;
}
&:hover {
border: 3px solid var( --color-neutral-dark );
padding: 0;
}
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 for the suggestion. Opened this issue to try this out: #38665
- use HTML button element to render Card - use span instead of div inside for valid markup
- add overlay with text for design selector items - add a grey border for items of layout selector
b8daf8e
to
15b1510
Compare
…n be visually identified
Fixed in 15b1510
Fixed in 9234d31
Fixed in 50a7ff9
When you are selecting pages (layouts) you're basically in a modal so the focus is captured to that context. So I'd say pressing ESC and then tabbing to another element is somehow expected. But given the fact we don't display an actual overlay on the rest of the page so all the action buttons are visible and clickable, we should discuss this further. Created #38664
To be implemented |
Changes proposed in this Pull Request
Add and use Reakit to implement the page selector as a
Dialog
. This should improve overall usability of the page selector.This fixes some lint issues as well as simplifies some styling, for example the full-width page selector overlay. Click outside and escape close the page selector.
Screens
Before
After
Follow up
Use ReakitRover
for tab access to designs and templates in the page selector.used
Card as="button"
for now.Testing instructions
/gutenboarding
.