-
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
Media plan storage indicator: add accessible tooltip #45190
Conversation
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Webpack Runtime (~310 bytes added 📈 [gzipped])
Webpack runtime for loading modules. It is included in the HTML page as an inline script. Is downloaded and parsed every time the app is loaded. App Entrypoints (~33 bytes added 📈 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~36496 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 (~25016 bytes added 📈 [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. |
@@ -171,6 +171,7 @@ $z-layers: ( | |||
'.dialog__backdrop': 100200, | |||
'.wplink__dialog.dialog.card': 100200, | |||
'.web-preview': 100200, | |||
'.plan-storage__tooltip': 100300, |
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.
As the reakit tooltip sits outside the flow at the end of the page, we need a z-index higher than the media library modal at 100200.
I'm not over the moon about introducing a new Tooltip component and not fixing/replacing the existing one, to be honest. @Automattic/team-calypso Do you have thoughts/preferences on this? Is moving |
I noticed that the (I also want to note that @wordpress/components, @wordpress/block-editor also depend on reakit, so it's not 100% new to calypso) |
I have no issue with the Reakit use here overall. As @mreishus notes, it's already used heavily by WordPress/gutenberg#21275 (comment) I don't want to over-complicate this PR by requiring that we sort all of this out fully before merging. However, the many @diegohaz Is there a straightforward way to reuse elements of Reakit's positioning and ARIA support in the context of Calypso's existing components? Perhaps via state and/or props hooks? |
Agreed. Reading @jeryj's a11y considerations in paYJgx-WR-p2, a more holistic update to all Tooltips in Calypso definitely seems desirable. That said, it would probably be a lot more involved (if only for the amount of testing required to make sure we cover all use cases and don't break anything). So in the interest of making progress on and solving the specific use case in #40986 the idea was to try reakit's Tooltip component as a proof of concept here first. As @mreishus and @griffbrad noted reakit is already used in core and "will likely be used elsewhere in Calypso as well".
Definitely! Just updated it to the latest stable version.
Agreed, I removed them. FWIW I had used these styles to force the arrow positioning to the bottom right end of the reference element to reflect the design here #40986 (comment). @diegohaz When trying the placement options on the tooltip arrow they weren't working as expected. What's the right way to get the arrow to stick to the bottom of the tooltip (plus when it flips on the top of the tooltip) and point to the end of the reference element as show in this design #40986 (comment)? |
72377fb
to
6810194
Compare
6810194
to
38513ad
Compare
The arrow component expects to receive the The arrow element is always positioned at the center relatively to the reference element. And as far as I know, Popper.js doesn't give us an option to change this. But I think you can just set a Considering that the arrow width is .tooltip__arrow {
margin-left: calc(50% - 0.5em);
} |
I see! In that case the unexpected placements of the arrow when changing the placement to a different value than the reference element's placement was indeed the expected result. :) I would've thought a separate arrow placement would be a feature included in Popper.js. No worries, moving it with CSS works well in that case then. Thank you, @diegohaz! |
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.
Nice work @frontdevde!
This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/4277552 Thank you @frontdevde for including a screenshot in the description! This is really helpful for our translators. |
Translation for this Pull Request has now been finished. |
Changes proposed in this Pull Request
This PR adds an accessible tooltip to the plan storage indicator in
/media
.See paYJgx-WR-p2 for use of reakit and a11y considerations.
Fixes #40986
I also noticed that the plan storage block doesn't have a focus style that matches the rest of the buttons in the media library. I changed it to now match the other blocks.
Testing instructions
/media