From d948a5f3c06cf4dbbdc8f77685cefff5cb36bd2d Mon Sep 17 00:00:00 2001 From: Benny Powers Date: Wed, 15 Apr 2026 15:42:32 +0300 Subject: [PATCH 1/3] fix(switch): add static accessible label 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) --- .changeset/fix-switch-a11y.md | 6 ++++++ elements/pf-switch/demo/without-label.html | 2 +- elements/pf-switch/pf-switch.ts | 5 +++-- elements/pf-switch/test/pf-switch.spec.ts | 21 +++++++++++++++++++++ 4 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 .changeset/fix-switch-a11y.md diff --git a/.changeset/fix-switch-a11y.md b/.changeset/fix-switch-a11y.md new file mode 100644 index 0000000000..86201136d4 --- /dev/null +++ b/.changeset/fix-switch-a11y.md @@ -0,0 +1,6 @@ +--- +"@patternfly/elements": patch +--- + +`pf-switch`: the switch now has a proper static accessible label +independent of its on/off state text. diff --git a/elements/pf-switch/demo/without-label.html b/elements/pf-switch/demo/without-label.html index c6c8a50b05..6662e471e2 100644 --- a/elements/pf-switch/demo/without-label.html +++ b/elements/pf-switch/demo/without-label.html @@ -2,7 +2,7 @@
Without label - +
diff --git a/elements/pf-switch/pf-switch.ts b/elements/pf-switch/pf-switch.ts index 6b87fe359d..c8f559a2d5 100644 --- a/elements/pf-switch/pf-switch.ts +++ b/elements/pf-switch/pf-switch.ts @@ -24,8 +24,8 @@ export class PfSwitch extends LitElement { #internals = InternalsController.of(this, { role: 'switch' }); - /** Accessible label text for the switch */ - @property({ reflect: true }) label?: string; + /** Accessible label for the switch when there is no associated `