Skip to content

fix(switch): add static accessible label#3094

Merged
bennypowers merged 5 commits intomainfrom
fix/switch-accessible-label
Apr 15, 2026
Merged

fix(switch): add static accessible label#3094
bennypowers merged 5 commits intomainfrom
fix/switch-accessible-label

Conversation

@bennypowers
Copy link
Copy Markdown
Member

Summary

  • Rename label property to accessibleLabel (accessible-label attribute)
  • Wire to ariaLabel on ElementInternals for a proper static accessible name
  • Updated "without label" demo to use accessible-label
  • Added tests for accessible label behavior

Closes #2754

Test plan

  • Verify switch has accessible name when accessible-label is set
  • Verify accessible name is static regardless of checked state
  • Run tests: npx wtr elements/pf-switch/test/pf-switch.spec.ts

Rename `label` property to `accessibleLabel` (attribute:
`accessible-label`) for consistency. Wire it to set `ariaLabel`
on element internals for a proper static accessible name.

Closes #2754

Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 15, 2026

🦋 Changeset detected

Latest commit: 9251fb6

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

This PR includes changesets to release 1 package
Name Type
@patternfly/elements 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

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 15, 2026

Deploy Preview for patternfly-elements ready!

Name Link
🔨 Latest commit df0df15
😎 Deploy Preview https://deploy-preview-3094--patternfly-elements.netlify.app/

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 15, 2026

✅ Commitlint tests passed!

More Info
{
  "valid": true,
  "errors": [],
  "warnings": [],
  "input": "fix(switch): add static accessible label"
}

@github-actions github-actions bot added the AT passed Automated testing has passed label Apr 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

SSR Test Run for bb828df: Report

@github-actions
Copy link
Copy Markdown
Contributor

SSR Test Run for 6e14398: Report

Comment thread elements/pf-switch/pf-switch.ts
bennypowers and others added 2 commits April 15, 2026 18:55
Keep the existing `label` property as deprecated and fall back
to it when `accessible-label` is not set. JSDoc advises updating
the accessible label based on checked state.

Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

SSR Test Run for e72c981: Report

@github-actions

This comment has been minimized.

@bennypowers bennypowers enabled auto-merge (squash) April 15, 2026 16:02
@bennypowers bennypowers merged commit 2a45088 into main Apr 15, 2026
14 checks passed
@bennypowers bennypowers deleted the fix/switch-accessible-label branch April 15, 2026 18:24
@github-actions
Copy link
Copy Markdown
Contributor

SSR Test Run for df0df15: Report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AT passed Automated testing has passed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] <pf-switch /> - Switch lacks a static accessible label

2 participants