From 04174da716850655fe2a79b87007af52cc91ac06 Mon Sep 17 00:00:00 2001 From: ShaneK Date: Mon, 24 Mar 2025 14:13:07 -0700 Subject: [PATCH 01/17] fix(checkbox): fix safari voice over not recognizing ion-checkbox as a checkbox --- core/src/components/checkbox/checkbox.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/components/checkbox/checkbox.tsx b/core/src/components/checkbox/checkbox.tsx index 2dbfbedbd1f..d5da1ffc46d 100644 --- a/core/src/components/checkbox/checkbox.tsx +++ b/core/src/components/checkbox/checkbox.tsx @@ -255,6 +255,7 @@ export class Checkbox implements ComponentInterface { return ( Date: Tue, 25 Mar 2025 06:13:39 -0700 Subject: [PATCH 02/17] fix(checkbox): fixing accessibility issues created by making host element a checkbox --- core/src/components/checkbox/checkbox.tsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/core/src/components/checkbox/checkbox.tsx b/core/src/components/checkbox/checkbox.tsx index d5da1ffc46d..67d564c870d 100644 --- a/core/src/components/checkbox/checkbox.tsx +++ b/core/src/components/checkbox/checkbox.tsx @@ -181,6 +181,15 @@ export class Checkbox implements ComponentInterface { this.ionBlur.emit(); }; + private onKeyDown = (ev: KeyboardEvent) => { + if (ev.key === ' ' || ev.key === 'Enter') { + ev.preventDefault(); + if (!this.disabled) { + this.toggleChecked(ev); + } + } + }; + private onClick = (ev: MouseEvent) => { if (this.disabled) { return; @@ -259,6 +268,10 @@ export class Checkbox implements ComponentInterface { aria-checked={indeterminate ? 'mixed' : `${checked}`} aria-describedby={this.getHintTextID()} aria-invalid={this.getHintTextID() === this.errorTextId} + aria-labelledby={inputId + '-lbl'} + aria-disabled={disabled ? 'true' : null} + tabindex="0" + onKeyDown={this.onKeyDown} class={createColorClasses(color, { [mode]: true, 'in-item': hostContext('ion-item', el), @@ -272,13 +285,15 @@ export class Checkbox implements ComponentInterface { })} onClick={this.onClick} > -