Skip to content

fix(ui): make sure button labels can overflow#92311

Merged
TkDodo merged 2 commits into
masterfrom
tkdodo/fix/de-72-button-overflow
Jun 4, 2025
Merged

fix(ui): make sure button labels can overflow#92311
TkDodo merged 2 commits into
masterfrom
tkdodo/fix/de-72-button-overflow

Conversation

@TkDodo

@TkDodo TkDodo commented May 27, 2025

Copy link
Copy Markdown
Collaborator

the old button as using display: inline-block, where overflow: hidden and text-overflow: ellipsis work as expected, as long as the element has a constrained width or max-width.

The new button uses display: inline-flex, and flex items do not shrink as expected unless The flex item has min-width: 0

before after
Screenshot 2025-05-27 at 16 48 36 Screenshot 2025-05-27 at 16 48 51

the old button as using `display: inline-block`, where `overflow: hidden` and `text-overflow: ellipsis` work as expected, as long as the element has a constrained width or max-width.

The new button uses `display: inline-flex`, and flex items do not shrink as expected unless The flex item has min-width: 0
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 27, 2025
Comment on lines 106 to 111
})<Pick<CommonButtonProps, 'size' | 'borderless'>>`
height: 100%;
min-width: 0;
display: flex;
align-items: center;
justify-content: center;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JonasBa do you know why we have this duplication between button and linkButton ?

@natemoo-re natemoo-re Jun 3, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LinkButton was split from Button to simplify the API surface, but it doesn't seem like we gain much from it imo

@TkDodo TkDodo marked this pull request as ready for review May 27, 2025 14:53
@TkDodo TkDodo requested a review from a team as a code owner May 27, 2025 14:53
@codecov

codecov Bot commented May 27, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #92311      +/-   ##
==========================================
- Coverage   87.91%   85.39%   -2.52%     
==========================================
  Files       10204    10199       -5     
  Lines      584456   584320     -136     
  Branches    22689    22670      -19     
==========================================
- Hits       513827   498986   -14841     
- Misses      70208    84913   +14705     
  Partials      421      421              

@natemoo-re natemoo-re left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a strong signal that our Button implementation isn't composable enough? Seems fine as a quick fix, but I expect similar edge cases to keep popping up.

@TkDodo TkDodo merged commit 04f5ce5 into master Jun 4, 2025
42 checks passed
@TkDodo TkDodo deleted the tkdodo/fix/de-72-button-overflow branch June 4, 2025 07:31
andrewshie-sentry pushed a commit that referenced this pull request Jun 4, 2025
the old button as using `display: inline-block`, where `overflow:
hidden` and `text-overflow: ellipsis` work as expected, as long as the
element has a constrained width or max-width.

The new button uses `display: inline-flex`, and flex items do not shrink
as expected unless The flex item has min-width: 0

| before | after |
|--------|--------|
| ![Screenshot 2025-05-27 at 16 48
36](https://github.com/user-attachments/assets/65185e5a-01b9-46c9-8169-a3a0713d13f3)
| ![Screenshot 2025-05-27 at 16 48
51](https://github.com/user-attachments/assets/6eaab4d6-0506-4f06-8c1f-360831669c64)
|
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants