-
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
CustomSelectControlV2: fix item styles #62825
Changes from all commits
0d8c8a1
f04567f
eccd3cd
ad808c5
0820b99
1ec1750
ee95320
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,6 +93,7 @@ export const Select = styled( Ariakit.Select, { | |
font-family: inherit; | ||
font-size: ${ CONFIG.fontSize }; | ||
text-align: start; | ||
user-select: none; | ||
width: 100%; | ||
|
||
&[data-focus-visible] { | ||
|
@@ -133,7 +134,15 @@ export const SelectItem = styled( Ariakit.SelectItem )` | |
justify-content: space-between; | ||
padding: ${ ITEM_PADDING }; | ||
font-size: ${ CONFIG.fontSize }; | ||
line-height: 2.15rem; // TODO: Remove this in default but keep for back-compat in legacy | ||
// TODO: reassess line-height for non-legacy v2 | ||
line-height: 28px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See #62825 (comment) |
||
scroll-margin: ${ space( 1 ) }; | ||
user-select: none; | ||
|
||
&[aria-disabled='true'] { | ||
cursor: not-allowed; | ||
} | ||
|
||
&[data-active-item] { | ||
background-color: ${ COLORS.theme.gray[ 300 ] }; | ||
} | ||
|
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.
To match 28px, the line height value should have been
2.15
(without therem
unit). I felt like a more explicitcalc
syntax would help to understand the reason for an arbitrary number.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.
It's curious where the 2.15 came from originally...
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.
It's the ratio of the line height (28px) to the font size (13px)
Also, since
28 / 13 = 2.15384615
, another consequence of using2.15
is that the resulting line height wouldn't be exactly 28px (as per design), but slightly less because of the lower decimal precision.In short: I prefer to let the browser (or sass) do the calculation, and if not possible, to state the
line-height
directly.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.
Which also makes me question if 28/13 was the intent. But yes, having a clear calc there makes things much clearer.