-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
ColorPicker: fix layout overflow #42992
Conversation
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 tests well for me 👍
✅ Unit tests pass
✅ No horizontal scrollbars in Storybook examples
✅ No change in editor (no scrollbars on trunk or this PR)
While testing, I encountered another minor issue with the ColorPicker appearing "under" the select controls in the GradientPicker story. At least until it is focused. This appears to be unrelated to this PR as it's also happening on trunk.
Demo of z-index issue
Screen.Recording.2022-08-05.at.2.09.27.pm.mp4
Thank you for your review! Let's wait for @mirka ' s opinion on whether this fix is appropriate, of if we should look into adding the
Interesting that you flagged it! I believe that's been around for a while (I believe at some point it was pointed out in a convo with @andrewserong too), but I also came across it yesterday and decided to open an issue with a list of improvements to In particular, the color picker appears "under" because the gradient bar has a style of |
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 don't have a great answer. To be honest the more I think about it, it's kind of complex. But in general, for now I'm inclined to put the box sizing reset on the root-level wrapper of the component, which is ColorfulWrapper
in this case.
The concerns I think we need to juggle are:
- Easier is better. Not having to manually add the reset in a ton of places is good.
- Less nesting of resets is better. From what I could gather, I think we should be fine in terms of performance, but nesting too many
*
glob rules seems... a bit messy. Of course, some nesting is unavoidable. But this is why I would prefer not to add the reset to components likeFlex
, which tend to be nested a lot.
8815915
to
42d5c4d
Compare
Makes sense. I've followed your advice and moved 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.
This is still testing well for me. 🚢
What?
This fixes a layout issue with
ColorPicker
, where the "copy to clipboard" button would end up being rendered further right than intended, causing the whole picker to scroll when embedded inside a popoverWhy?
Fixing a layout bug.
How?
The issue can be fixed by adding the
box-sizing
reset to the specific wrapper, although we should probably understand if we should apply the fix in a more generic way (i.e. to theHStack
or even theFlex
components) (cc @mirka )Testing Instructions
In Storybook:
Screenshots or screencast