Skip to content

fix: prevent button text wrapping using max-content for button min-width#2214

Merged
Bracciata merged 13 commits into
developfrom
fix/dont-wrap-button-contents
Feb 3, 2026
Merged

fix: prevent button text wrapping using max-content for button min-width#2214
Bracciata merged 13 commits into
developfrom
fix/dont-wrap-button-contents

Conversation

@Bracciata

@Bracciata Bracciata commented Jan 22, 2026

Copy link
Copy Markdown
Contributor

Closes #2190 and https://github.com/dequelabs/walnut/issues/13150 #1982

Updates buttons so they do not wrap unless overridden to wrap. Prevents button text from wrapping and no longer makes 6.25rem the minimum width for all buttons.

QA Steps:
Navigate to a page with a button
Shrink the width of the page until it is less than the width of the button
Verify the button doesn't wrap and instead overflows the page.

@aws-amplify-us-east-1

Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-2214.d15792l1n26ww3.amplifyapp.com

@Bracciata Bracciata marked this pull request as ready for review January 22, 2026 18:37
@Bracciata Bracciata requested review from a team as code owners January 22, 2026 18:37
Copilot AI review requested due to automatic review settings January 22, 2026 18:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR prevents button contents from wrapping by default, addressing issue #2190. The change ensures buttons maintain their natural width to accommodate content without wrapping unless explicitly overridden.

Changes:

  • Added min-width: max-content CSS property to button styles to prevent text wrapping
  • Added e2e test to verify default no-wrap behavior and override capability

Reviewed changes

Copilot reviewed 2 out of 19 changed files in this pull request and generated 1 comment.

File Description
packages/styles/button.css Adds min-width CSS property to prevent button text wrapping
packages/react/src/components/Button/screenshots.e2e.tsx Adds test coverage for button wrapping behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/react/src/components/Button/screenshots.e2e.tsx Outdated
@shawnsharpDQ

shawnsharpDQ commented Jan 22, 2026

Copy link
Copy Markdown

@Bracciata I am seeing that there used to be a max-width of 6.25rem on the button. The change you have implemented is what we would like from design but I am not sure if this will have a cascading effect across our products. Anyway to confirm if this is a breaking change or not?

Here is the cauldron ticket referring to the change #1982

@Bracciata

Bracciata commented Jan 22, 2026

Copy link
Copy Markdown
Contributor Author

@Bracciata I am seeing that there used to be a max-width of 6.25rem on the button. The change you have implemented is what we would like from design but I am not sure if this will have a cascading effect across our products. Anyway to confirm if this is a breaking change or not?

There is a good chance it is a breaking change within some repo. Thoughts on doing min-width: min(max-content, 6.25rem)?

@shawnsharpDQ

Correction. Not a breaking change as there was previously a min width and this is a desired change. The minimum still fits all content.

shawnsharpDQ
shawnsharpDQ previously approved these changes Jan 22, 2026

@shawnsharpDQ shawnsharpDQ left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

2 birds with 1 stone! Love it

@gupta-tanvi26

gupta-tanvi26 commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

Wondering if we want to implement this change across across other components too? Like the description list (just 1 example - I notice that the content wraps around for the description list details)

@anastasialanz

anastasialanz commented Feb 3, 2026

Copy link
Copy Markdown
Collaborator

I'm worried that this change could cause buttons to flow outside of their containers if they did wrap and think removing the min-width all together would be the better option like the original issue proposed. See the example here where the long text flows outside of the container: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/max-content.

Update: Since we don't want button text to wrap at all, I think we can update where needed if this causes a problem.

@Bracciata Bracciata changed the title fix: do not wrap button contents feat!: do not wrap button contents Feb 3, 2026
@Bracciata Bracciata changed the title feat!: do not wrap button contents fix!: do not wrap button contents Feb 3, 2026
@Bracciata Bracciata changed the title fix!: do not wrap button contents fix!: prevent button text wrapping with max-content as min-width Feb 3, 2026
@Bracciata Bracciata changed the title fix!: prevent button text wrapping with max-content as min-width fix!: prevent button text wrapping using max-content for button min-width Feb 3, 2026
@Bracciata Bracciata changed the title fix!: prevent button text wrapping using max-content for button min-width fix: prevent button text wrapping using max-content for button min-width Feb 3, 2026
@anastasialanz

anastasialanz commented Feb 3, 2026

Copy link
Copy Markdown
Collaborator

We chatted and decided to go with a non-breaking change for this commit because the button text should not wrap.

@Bracciata Bracciata merged commit f92cb92 into develop Feb 3, 2026
16 checks passed
@Bracciata Bracciata deleted the fix/dont-wrap-button-contents branch February 3, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Cauldron button labels should not wrap

5 participants