diff --git a/.changeset/fix-switch-a11y.md b/.changeset/fix-switch-a11y.md new file mode 100644 index 0000000000..7c2dbb57df --- /dev/null +++ b/.changeset/fix-switch-a11y.md @@ -0,0 +1,6 @@ +--- +"@patternfly/elements": patch +--- + +``: 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..aace554008 100644 --- a/elements/pf-switch/pf-switch.ts +++ b/elements/pf-switch/pf-switch.ts @@ -24,9 +24,16 @@ export class PfSwitch extends LitElement { #internals = InternalsController.of(this, { role: 'switch' }); - /** Accessible label text for the switch */ + /** @deprecated use `accessible-label` instead */ @property({ reflect: true }) label?: string; + /** + * Accessible label for the switch when there is no associated `