Add truncation
prop to Button
#4527
Draft
+715
−0
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.
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. This is a boolean, but I could refactor it to be closer to the prop I'm proposing here in React.
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
Testing & Reviewing
Merge checklist