Skip to content

Conversation

joshfarrant
Copy link
Contributor

@joshfarrant joshfarrant commented Jul 14, 2025

Summary

Updated the Button component to set the appropriate disabled attribute depending on the type of element rendered, e.g.

// All output <button disabled="true">Test</button>
<Button disabled>Test</Button>
<Button aria-disabled="true">Test</Button>

// All output <a aria-disabled="true">Test</a>
<Button as="a" disabled>Test></Button>
<Button as="a" aria-disabled="true">Test</Button>

What should reviewers focus on?

  • Check you're happy with the change in general

Steps to test

  1. Check that a button exclusively uses the disabled attribute and a link exclusively uses aria-disabled.

Supporting resources (related issues, external links, etc)

Contributor checklist

  • All new and existing CI checks pass
  • Tests prove that the feature works and covers both happy and unhappy paths
  • Any drop in coverage, breaking changes or regressions have been documented above
  • UI Changes contain new visual snapshots (generated by adding update snapshots label to the PR)
  • All developer debugging and non-functional logging has been removed
  • Related issues have been referenced in the PR description

Reviewer checklist

  • Check that pull request and proposed changes adhere to our contribution guidelines and code of conduct
  • Check that tests prove the feature works and covers both happy and unhappy paths
  • Check that there aren't other open Pull Requests for the same update/change

Copy link

changeset-bot bot commented Jul 14, 2025

🦋 Changeset detected

Latest commit: 26bad2a

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

This PR includes changesets to release 8 packages
Name Type
@primer/react-brand Patch
@primer/brand-docs Patch
@primer/brand-css Patch
@primer/brand-primitives Patch
@primer/brand-e2e Patch
@primer/brand-fonts Patch
@primer/brand-config Patch
@primer/brand-storybook 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

@joshfarrant joshfarrant changed the title remove aria-disabled prop from Button and set appropriate disabled at… Set appropriate disabled attribute on Button depending on rendered HTML element Jul 14, 2025
Copy link
Contributor

github-actions bot commented Jul 14, 2025

🟢 No design token changes found

Copy link
Contributor

github-actions bot commented Jul 14, 2025

🟢 No visual differences found

Our visual comparison tests did not find any differences in the UI.

@joshfarrant joshfarrant force-pushed the joshfarrant/a11y-3739 branch 2 times, most recently from cb9c816 to 0999b49 Compare July 14, 2025 14:05
@joshfarrant joshfarrant marked this pull request as ready for review July 14, 2025 14:20
@joshfarrant joshfarrant requested review from Copilot and rezrah July 14, 2025 14:20
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the Button component to automatically set the appropriate disabled attribute based on the rendered HTML element type. Button elements use the disabled attribute while other elements (like links) use the aria-disabled attribute.

Key changes:

  • Modified Button component logic to conditionally set disabled attributes based on element type
  • Added comprehensive test coverage for various disabled states and element types
  • Added changeset documentation for the breaking change

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/react/src/Button/Button.tsx Updated component logic to conditionally set disabled/aria-disabled attributes based on element type
packages/react/src/Button/Button.test.tsx Added comprehensive test cases covering disabled states for button and link elements
.changeset/warm-meals-learn.md Added changeset documentation for the minor version update
Comments suppressed due to low confidence (1)

packages/react/src/Button/Button.tsx:156

  • [nitpick] The variable name disabledProp could be more descriptive. Consider renaming it to disabledAttributes or disabledProps to better reflect that it contains an object with disabled-related attributes.
    let disabledProp

Copy link
Collaborator

@rezrah rezrah left a comment

Choose a reason for hiding this comment

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

Pre-emptively approving, but there's some feedback on the changeset I'd love your thoughts on @joshfarrant

@joshfarrant joshfarrant merged commit 5ef7878 into main Jul 18, 2025
18 checks passed
@joshfarrant joshfarrant deleted the joshfarrant/a11y-3739 branch July 18, 2025 20:21
@primer-css primer-css mentioned this pull request Jul 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants