Skip to content
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

Add labelWrap prop to Button #4527

Merged
merged 9 commits into from
Jun 14, 2024
Merged

Add labelWrap prop to Button #4527

merged 9 commits into from
Jun 14, 2024

Conversation

langermank
Copy link
Contributor

@langermank langermank commented Apr 22, 2024

This has been an ongoing issue with the Button component across all frameworks. Previously, we had hoped to introduce this change that allows button labels to wrap by default if the label string is too long. However, after testing this behind a feature flag for a bit we continued to find random issues across dotcom as the change can lead to unpredictable layout regressions.

In Rails, to unblock a few open accessibility issues I decided to introduce the change with a param.

The only way to make this change the default is with a major release, and even then we would need to babysit it and individually fix each area where layout breaks. I don't think this is realistic, and feel like introducing it as a prop should be sufficient for unblocking teams and mitigating accessibility issues.

Closes https://github.com/github/primer/issues/3123

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

@langermank langermank requested a review from a team as a code owner April 22, 2024 23:12
Copy link

changeset-bot bot commented Apr 22, 2024

🦋 Changeset detected

Latest commit: 8e0f700

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Apr 22, 2024

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 89.62 KB (+0.18% 🔺)
packages/react/dist/browser.umd.js 89.93 KB (+0.23% 🔺)

@github-actions github-actions bot temporarily deployed to storybook-preview-4527 April 23, 2024 01:11 Inactive
@langermank langermank marked this pull request as draft April 26, 2024 19:37
@mperrotti mperrotti changed the title Add truncation prop to Button Add labelWrap prop to Button Jun 11, 2024
@mperrotti mperrotti marked this pull request as ready for review June 11, 2024 22:56
@github-actions github-actions bot temporarily deployed to storybook-preview-4527 June 11, 2024 22:59 Inactive
</Button>
<Button labelWrap trailingAction={TriangleDownIcon}>
This button label will wrap if the label is too long
</Button>
Copy link
Member

Choose a reason for hiding this comment

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

Maybe include one that isn't wrapping to show along with the wrapping ones?

Copy link
Member

@jonrohan jonrohan left a comment

Choose a reason for hiding this comment

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

👍🏻 Pretty straight forward

@langermank langermank added this pull request to the merge queue Jun 14, 2024
Merged via the queue into main with commit 623b16e Jun 14, 2024
30 checks passed
@langermank langermank deleted the button-truncation branch June 14, 2024 21:08
@primer primer bot mentioned this pull request Jun 14, 2024
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.

3 participants