-
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
FontSizePicker: Add flag to remove bottom margin #43062
Conversation
Size Change: +122 B (0%) Total Size: 1.27 MB
ℹ️ View Unchanged
|
be609ba
to
6bc2f8e
Compare
@@ -212,6 +213,7 @@ function UnforwardedRangeControl< IconProps = unknown >( | |||
|
|||
return ( | |||
<BaseControl |
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.
@ciampo There is an ever so slight space here that I can only resolve by setting a line-height: 0
on .components-base-control__field
, and I don't know what is happening 😂 Let me know if you have any ideas.
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.
That's the typical "white space" issue that happens around inline elements — there are different ways to fix, including setting font-size: 0
or line-height: 0
on .components-base-control__field
.
But in my opinion those are just "patchy" fixes — a better way to handle it is to avoid having inline elements, which cause the white space in the first place.
The easiest fix would be to change RangeControl
's Root
element from display: inline-flex
to display: flex
.
In case there was a reason for that Root
element to be inline-flex
and we don't want to touch it, another alternative is to set display: flex; flex-direction: column
on .components-base-control__field
(also in this scenario, we'd need to check that this change doesn't introduce any regression).
Bonus round: for both proposed solutions, we could use HStack
or VStack
instead!
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 had so much trouble finding the culprit, thank you 😂
The easiest fix would be to change
RangeControl
'sRoot
element fromdisplay: inline-flex
todisplay: flex
.
I went with this fix — it looks safe from what I could gather.
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.
Code changes are looking good. I'll give it a last round of review once the white space glitch is addressed !
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.
Also noting that e2e failures may be related, since they're flagging an issue with the Font Size Picker tests
It was 😱 I'm so glad there was a test that caught it, it would've been very bad if that was merged 😱😱 9db8f69 Conditional Components: A Cautionary Tale |
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.
LGTM 🚀
I only noticed still a little glimpse of a white space in the RangeControl
component when adding a before/after icon
Kapture.2022-08-11.at.18.12.52.mp4
It should be fixable by setting display: flex
on AfterIconWrapper
and BeforeIconWrapper
(but I haven't double-checked) 🤞
Feel free to merge once this small details is taken care of :)
a313a01
to
aa8d839
Compare
Closes #38720
Part of #39358
What?
Adds a
__nextHasNoMarginBottom
prop to the following components, to opt into the new margin-free styles.Why?
For easier reuse and consistency in spacing.
How?
This PR just adds the flags. The in-repo migration and official deprecation tasks will continue to be tracked at #39358.
Testing Instructions
Apply this patch for easier testing in Storybook (it injects a colored div after the component):
npm run storybook:dev
Check the stories for ToggleGroupControl, RangeControl, and FontSizePicker.