diff --git a/CHANGELOG.md b/CHANGELOG.md index db21734ae..d089856bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Fixed a bug where clicking a tag in `sl-select` wouldn't toggle the menu - Fixed a bug where options where `sl-select` options weren't always visible or scrollable - Fixed a bug where setting `null` on `sl-input`, `sl-textarea`, or `sl-select` would throw an error +- Fixed a bug where `role` was on the wrong element and aria attribute weren't explicit in `sl-checkbox`, `sl-switch`, and `sl-radio` - Optimized `hasSlot` utility by using a simpler selector ## 2.0.0-beta.16 diff --git a/src/components/checkbox/checkbox.tsx b/src/components/checkbox/checkbox.tsx index 76101ca83..f385db586 100644 --- a/src/components/checkbox/checkbox.tsx +++ b/src/components/checkbox/checkbox.tsx @@ -115,7 +115,6 @@ export class Checkbox { 'checkbox--indeterminate': this.indeterminate }} htmlFor={this.inputId} - role="checkbox" onMouseDown={this.handleMouseDown} > @@ -156,6 +155,8 @@ export class Checkbox { value={this.value} checked={this.checked} disabled={this.disabled} + role="checkbox" + aria-checked={this.checked} aria-labelledby={this.labelId} onClick={this.handleClick} onBlur={this.handleBlur} diff --git a/src/components/radio/radio.tsx b/src/components/radio/radio.tsx index dbf8dd313..fe9a9e476 100644 --- a/src/components/radio/radio.tsx +++ b/src/components/radio/radio.tsx @@ -139,7 +139,6 @@ export class Radio { 'radio--focused': this.hasFocus }} htmlFor={this.inputId} - role="radio" onKeyDown={this.handleKeyDown} onMouseDown={this.handleMouseDown} > @@ -162,6 +161,8 @@ export class Radio { value={this.value} checked={this.checked} disabled={this.disabled} + role="radio" + aria-checked={this.checked} aria-labelledby={this.labelId} onClick={this.handleClick} onBlur={this.handleBlur} diff --git a/src/components/switch/switch.tsx b/src/components/switch/switch.tsx index c85d1c395..d2298fd9d 100644 --- a/src/components/switch/switch.tsx +++ b/src/components/switch/switch.tsx @@ -110,7 +110,6 @@ export class Switch {