Skip to content

Add labelWrap prop to Button - #4527

Merged
langermank merged 9 commits into
mainfrom
button-truncation
Jun 14, 2024
Merged

Add labelWrap prop to Button#4527
langermank merged 9 commits into
mainfrom
button-truncation

Conversation

@langermank

@langermanklangermank commented Apr 22, 2024

Copy link
Copy Markdown
Contributor

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.

Closeshttps://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 ownerApril 22, 2024 23:12
@changeset-bot

changeset-botBot commented Apr 22, 2024

Copy link
Copy Markdown

🦋 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
NameType
@primer/reactMinor

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

@langermanklangermank added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Apr 22, 2024
@github-actions

github-actionsBot commented Apr 22, 2024

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
packages/react/dist/browser.esm.js89.62 KB (+0.18% 🔺)
packages/react/dist/browser.umd.js89.93 KB (+0.23% 🔺)

@github-actionsgithub-actionsBot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Apr 22, 2024
@github-actions
github-actionsBottemporarily deployed to storybook-preview-4527 April 22, 2024 23:23 Inactive
@github-actions
github-actionsBottemporarily deployed to storybook-preview-4527 April 23, 2024 01:11 Inactive
@langermank
langermank marked this pull request as draft April 26, 2024 19:37
@mperrottimperrotti changed the title Add truncation prop to ButtonAdd labelWrap prop to ButtonJun 11, 2024
@mperrotti
mperrotti marked this pull request as ready for review June 11, 2024 22:56
@github-actions
github-actionsBottemporarily deployed to storybook-preview-4527 June 11, 2024 22:59 Inactive
@github-actions
github-actionsBottemporarily deployed to storybook-preview-4527 June 12, 2024 20:04 Inactive
@github-actions
github-actionsBottemporarily deployed to storybook-preview-4527 June 13, 2024 21:29 Inactive
</Button>
<Button labelWrap trailingAction={TriangleDownIcon}>
This button label will wrap if the label is too long
</Button>

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.

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

@jonrohanjonrohan 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.

👍🏻 Pretty straight forward

@langermank
langermank added this pull request to the merge queueJun 14, 2024
Merged via the queue into main with commit 623b16eJun 14, 2024
@langermank
langermank deleted the button-truncation branch June 14, 2024 21:08
@primerprimerBot mentioned this pull request Jun 14, 2024
Sign up for freeto 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

@langermank@jonrohan@mperrotti