-
Notifications
You must be signed in to change notification settings - Fork 639
Tooltip2: hide the tooltip from AT when it is not open #3910
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
Conversation
🦋 Changeset detectedLatest commit: 1fcb31a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
size-limit report 📦
|
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 going to mark this as request changes because I want to keep a close eye on these changes before they ship.
I think now we're using @oddbird/[email protected] - which injects stylesheets in JS - we can remove a lot of the CSS and the polyfill will do the correct accessible thing.
I think the correct diff for this PR would look like removing the popoverStyles const, and related polyfill code, and I don't think we'll need to add any additional CSS.
| max-width: 250px; | ||
| inset: auto; | ||
| /* Overriding the default popover styles */ | ||
| &[popover] { |
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.
This was needed for firefox. Otherwise the styles wasn't applied due to [popover] having more specificity than the styled component's class name.
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.
This trick caused a bit of a flashing though.
Rewatch.Screen.Recording.-.2023-11-07.at.12.15.mp4
Video description: There is a "Delete" button and the page is reloaded. The tooltip text without any styles appears right under the button very briefly like flashing then disappears
And if I load the style component (the tooltip element itself) with display: 'none' and then add display: 'block' when it is open, the flash is gone (commit for changes) but I am not sure if this is a good way to solve this. Let me know if you have any a way of solving this already or any other thoughts!
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.
This looks reasonable for now. The polyfill injecting CSS means that we suffer from a FOUC, which is also true for dotcom today. I'm looking into ways to minimise or remove the FOUC but given it's only Firefox, and Firefox will soon be shipping native popovers, it's not a blocking concern.
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.
And if I load the style component (the tooltip element itself) with display: 'none' and then add display: 'block' when it is open
I kinda like this as a temporary measure but also if the flash only happens in firefox, we can choose to ignore it. No strong feelings, up to you
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.
Just to clarify, the fix that needed for firefox was adding the [popover] attribute selector to the class styling but this addition caused flashing in all browsers. So I guess it is better to keep it until Firefox catches up.
Thanks for the review @keithamus! I really appreciate it. I pushed another commit based on your suggestions, and everything worked (with just a tiny adjustment) as you described 🎉 |
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.
This now looks great!
![]()
|
@siddharthkp Could I get your approval please if it looks good? Need primer-react approval to merge 👀 |
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.
Ship it!
Oh, my bad! Didn't realise that. |
|
👍 |
Closes https://github.com/github/primer/issues/2822
Changelog
New
Changed
Initially we were rendering the tooltip element visually hidden even when it is not opened but we received a feedback from the sign-off review that the tooltip should be hidden from screen readers when it is not visible for visual users too.
In the meantime, the popover-polyfill released a major change that injects the styles with JS, therefore no need to tweak anything in the CSS itself. This PR;
display: nonealready.As always, shout out to @keithamus for his guidance here 🎉
Before
Removed
Rollout strategy
Testing & Reviewing
Merge checklist
Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.