-
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
Fix color picker saturation overlay offset #19693
Fix color picker saturation overlay offset #19693
Conversation
I so wish we could track down whatever the weird CSS issue is to fix this 😭 But thank you so much for looking into this and putting in a fix! This seems like a low-risk fix that does address it 👍 |
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 is an issue with how the browser renders button
.
Changing it to a div
with aria labels fixes this.
Nice catch, @epiqueras! Semantically, I don't think this should end up being a button anyways. It doesn't have any Enter/Spacebar function or submit anything. Maybe there's a better role to use than |
It does at first, but as soon as we make it tab-able again the problem comes back. I assume we want to keep it tab-able for a11y concerns. I tried changing it to a (also rebased) |
f38537e
to
156ed43
Compare
Yeah, it would definitely need to remain focusable. I'd never heard of adding I think we can drop the |
Right, IF we went with the |
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.
Removing this:
.components-color-picker__saturation-color {
overflow: hidden;
}
fixes it.
Apologies for missing the ping. I'm looking into this now, and I'm almost certain there's a CSS only fix for this. I'm not really able to reproduce the issue as it was back in january, but I'll keep looking. |
I created #23272 as a CSS only alternative to this one. Can you test it and let me know if it fixes the issue for you? |
Thanks @jasmussen ! It is relieving to see that there is a CSS-only fix for this. We were aiming for that but never were able to find a working solution. That other PR #23272 solves the issue and I will close this in favor of that.
I wasn't able to at first, then I found that the issue changed slightly. Instead of being triggered by the far right edge of the container, it moved to being triggered by the bottom edge. However, the #23272 fixes this as noted. 🎉 |
Description
Fixes issue #19610 .
Previously, when the saturation component loaded with the picker on the right side it would cause the
scrollLeft
value to be several pixels, causing the issue noted in #19610 .Before this PR
In absence of finding a CSS rule to fix this behavior, forcing a
scroll(0,0)
in the parent element on mounting of the component will fix the issue.After scroll on mount
But as you may notice, the pointer is now almost all the way off the screen. It turns out the
transform: translate(x,y)
property in the CSS was set for a picker of 8px width/height. Since the picker is now 14px wide/tall it was necessary to update this translate value as well. (Update, set the translate to use % based values so this will be less of an issue in the future)After this PR
How has this been tested?
Tested on local docker environment.
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: