Skip to content

Conversation

@Kalpana-chavhan
Copy link

What this PR does

This PR adds a non-breaking accessibility check to the Button component that warns developers when a button is visually "empty" (icon-only, loading-only, or square) and lacks an ARIA label.

Why is this needed?

To ensure WCAG 2.1 compliance. Icon-only buttons are unusable for screen reader users unless an aria-label is provided. This warning helps developers catch these omissions during development.

Changes

  • Updated Button.tsx to include Children from React.
  • Added logic to detect "visual-only" buttons.
  • Included a console.warn wrapped in a production-environment check.

Testing

  1. Render <Button icon="edit" /> -> Console should show warning.
  2. Render <Button icon="edit" aria-label="Edit" /> -> No warning.
  3. Render <Button>Save</Button> -> No warning.

closes #1810

@changeset-bot
Copy link

changeset-bot bot commented Jan 1, 2026

⚠️ No Changeset found

Latest commit: cd1753c

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

@CLAassistant
Copy link

CLAassistant commented Jan 1, 2026

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

[Improvement]: Add development warning for icon-only Buttons missing accessible labels

2 participants