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

Allow Button to break-word for extra long labels (edge cases) #4062

Closed
wants to merge 6 commits into from

Conversation

langermank
Copy link
Contributor

Closes #

Changelog

New

Changed

Removed

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

Copy link

changeset-bot bot commented Dec 14, 2023

⚠️ No Changeset found

Latest commit: 9fb8940

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link
Contributor

github-actions bot commented Dec 14, 2023

size-limit report 📦

Path Size
dist/browser.esm.js 104.61 KB (+0.13% 🔺)
dist/browser.umd.js 105.25 KB (+0.14% 🔺)

@mperrotti
Copy link
Contributor

I have a path forward for preserving the top and bottom padding for buttons with wrapping lines of text.

We can set the following styles on the "buttonContent" container element:

align-self: stretch;
padding-block: calc(var(--control-{size}-paddingBlock, {fallback}) - 2px)

These styles force .buttonContent to fill the height of the button, then adds the correct amount of padding minus the top and bottom borders.

@mperrotti
Copy link
Contributor

Talked to Katie about my idea on Slack and got the go-ahead to push up changes.

Copy link
Contributor

@mperrotti mperrotti left a comment

Choose a reason for hiding this comment

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

Idk if I can approve these changes since I pushed a commit, but I'm trying it anyway.

@langermank - we just need a changeset.

Copy link
Collaborator

@pksjce pksjce left a comment

Choose a reason for hiding this comment

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

Hi 👋 Thanks for the changes @langermank!
As far as I understand this change is a potential fix for https://github.com/github/accessibility-audits/issues/4690

On deeper investigation, I found that the particular bug is probably a rails issue because it looks like this is the source code for the bug mentioned in the issue. So I don't think this particular PR solves any reported issues.

Other things to consider are

  1. This could potentially be an issue in PRC too. Esp with a Button in a container like a Dialog. We can see it is broken in the Dialog stories which currently uses the deprecated Button component. We'd need to refactor it to the latest Button to confirm this.
  2. If a Button is present directly on a page, it's not an issue because even on the highest zoom, the page will comfortably overflow and the user will be able to scroll across to view all of the button text (unlike in a dialog where it simply gets cut off).
  3. A cursory investigation in dotcom shows that buttons can have long and dynamic texts frequently. I wonder how this PR affects them. Do you think we can get some input from product devs to get an insight into this? Do you know whom we can add to this review?

src/Button/styles.ts Outdated Show resolved Hide resolved
Copy link
Contributor

Hi! This pull request has been marked as stale because it has been open with no activity for 60 days. You can comment on the pull request or remove the stale label to keep it open. If you do nothing, this pull request will be closed in 7 days.

@github-actions github-actions bot added the Stale label Mar 24, 2024
@github-actions github-actions bot closed this Mar 31, 2024
@github-actions github-actions bot deleted the make-button-break-word branch March 31, 2024 01:28
@langermank langermank mentioned this pull request Apr 22, 2024
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants