Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat(button): allow button to increase in height when text wraps #27547
feat(button): allow button to increase in height when text wraps #27547
Changes from all commits
4bd5e1e
4754703
c580970
fc5366f
6b0c29e
acc0715
a023423
6516ee4
a126529
8092213
eb77dab
06909bf
b5df308
ffa307f
1226aa6
13a5655
88b448e
84db5ce
8a8dcff
0a41736
f345d93
94d18c4
1957d51
46d60af
657109b
360628b
859f2cb
d67a688
2fe8870
23f1fe7
85a2ab2
5c0e69f
6053e0f
c4f7bc5
162ff26
74bed96
d4a1c99
c4da8b4
a63c246
b8320d8
31a31c1
37811ce
da0ef0d
6f125a7
7d30a65
69c1f84
c01a1e1
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
font-size: 1.4em
withmin-height: 25px
was triggering a browser rendering issue where the text in a button was misaligned with the icon. We did not notice this before because the button height washeight: 25px
. Now that the height of the button is only the minimum height we are now seeing this bug. The issue appears to be that the height of the icon is causing the text to be misaligned.We tried to fix it by setting
min-height: 25.19px
onion-button
. This fixed the issue for Chrome and Firefox, but it made the problem worse for Safari. Instead, we found that by using a slightly smaller icon size we can get the icon and the text to be aligned.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 also turns out that the icons were not aligned with the text in
main
even withheight: 25px
. Looks likemin-height: 25px
made the issue worse enough that we are noticing it now.In
main
, there are 2px of blank space at the bottom of the text relative to the bottom of the icon. Inbranch
, there is 1px of blank space above and below the text.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.
Note that some buttons may have an "off by 1" alignment due to fonts that are odd (i.e.
13px
). This is a problem inmain
too, so this change does not worsen the issue.Example: The small button on MD has a font size of 12px. 1.4em * 12 = 16.8 (which gets rounded to 17px). As a result small buttons in
main
have an off by 1 alignment issue.However, the large button has a font size of 20px. 1.35em (the new icon size) * 20 = 27. As a result, large buttons will have an off by 1 alignment issue instead of small buttons.
Long term we should avoid odd font sizes.
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.
The small items in an item on MD also have a font size of 12px which results in 1.4 * 12 = 16.8 (rounded to 17px). I considered changing this to be 13px to avoid changing the icon size. However, this caused larger visual regressions than I was comfortable with, so I opted to stick with the above approach.