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 user to override Button and IconButton aria-disabled #4426

Merged
merged 3 commits into from
Mar 22, 2024

Conversation

iansan5653
Copy link
Contributor

Closes #3991

It looks like in #3582 we added support for aria-disabled styling on button components, which is awesome! Except that we accidentally introduced a regression where consumers cannot set the aria-disabled attribute on these components. This is because we are setting aria-disabled in ButtonBase after we spread the consumer's props.

The fix here is simply to move this line earlier, so the consumer can override the attribute.

Alternatively, we could instead force aria-disabled to be true when loading, regardless of what the consumer sets, but then respect the consumer's prop all other times. That's not a hard change to make if we prefer to go that route.

Changelog

Changed

  • Fixes a bug where consumers cannot override buttons' aria-disabled attribute

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

@iansan5653 iansan5653 requested a review from a team as a code owner March 22, 2024 18:10
Copy link

changeset-bot bot commented Mar 22, 2024

🦋 Changeset detected

Latest commit: 7248955

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 Patch

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 Mar 22, 2024

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 88.58 KB (-0.03% 🔽)
packages/react/dist/browser.umd.js 88.98 KB (+0.22% 🔺)

Copy link
Contributor

@langermank langermank left a comment

Choose a reason for hiding this comment

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

Awesome, thank you!

@iansan5653 iansan5653 added this pull request to the merge queue Mar 22, 2024
Merged via the queue into main with commit 369c303 Mar 22, 2024
30 checks passed
@iansan5653 iansan5653 deleted the aria-disabled-buttons branch March 22, 2024 18:57
@primer primer bot mentioned this pull request Mar 22, 2024
lukasoppermann pushed a commit that referenced this pull request Apr 16, 2024
* Allow user to override button `aria-disabled`

* Add test

* Add changeset
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.

Apply 'disabled' styling when aria-disabled is set on a Button or IconButton
2 participants