Skip to content

Commit

Permalink
fix(a11y): mirror disabled prop to aria attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
willmartian committed Jun 30, 2021
1 parent f3d6abb commit fec4d40
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 179 deletions.
1 change: 1 addition & 0 deletions core/src/components/card/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export class Card implements ComponentInterface, AnchorInterface, ButtonInterfac
const mode = getIonMode(this);
return (
<Host
aria-disabled={this.disabled ? 'true' : null}
class={createColorClasses(this.color, {
[mode]: true,
'card-disabled': this.disabled,
Expand Down
1 change: 1 addition & 0 deletions core/src/components/checkbox/checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export class Checkbox implements ComponentInterface {
onClick={this.onClick}
aria-labelledby={label ? labelId : null}
aria-checked={`${checked}`}
aria-disabled={disabled ? 'true' : null}
aria-hidden={disabled ? 'true' : null}
role="checkbox"
class={createColorClasses(color, {
Expand Down
1 change: 1 addition & 0 deletions core/src/components/item-option/item-option.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export class ItemOption implements ComponentInterface, AnchorInterface, ButtonIn
return (
<Host
onClick={this.onClick}
aria-disabled={disabled ? 'true' : null}
class={createColorClasses(this.color, {
[mode]: true,
'item-option-disabled': disabled,
Expand Down
1 change: 1 addition & 0 deletions core/src/components/radio/radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export class Radio implements ComponentInterface {
return (
<Host
aria-checked={`${checked}`}
aria-disabled={disabled ? 'true' : null}
aria-hidden={disabled ? 'true' : null}
aria-labelledby={label ? labelId : null}
role="radio"
Expand Down
1 change: 1 addition & 0 deletions core/src/components/range/range.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ export class Range implements ComponentInterface {
onFocusin={this.onFocus}
onFocusout={this.onBlur}
id={rangeId}
aria-disabled={disabled ? 'true' : null}
class={createColorClasses(this.color, {
[mode]: true,
'in-item': hostContext('ion-item', el),
Expand Down
1 change: 1 addition & 0 deletions core/src/components/segment/segment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ export class Segment implements ComponentInterface {
const mode = getIonMode(this);
return (
<Host
aria-disabled={this.disabled ? 'true' : null}
role="tablist"
onClick={this.onClick}
class={createColorClasses(this.color, {
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/select/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ export class Select implements ComponentInterface {
<div class="select-icon" role="presentation" part="icon">
<div class="select-icon-inner"></div>
</div>
<label id={labelId}>
<label id={labelId} htmlFor={inputId}>
{displayLabel}
</label>
<button
Expand Down
1 change: 1 addition & 0 deletions core/src/components/tab-button/tab-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export class TabButton implements ComponentInterface, AnchorInterface {
onKeyup={this.onKeyUp}
role="tab"
tabindex={tabIndex}
aria-disabled={disabled ? 'true' : null}
aria-selected={selected ? 'true' : null}
id={tab !== undefined ? `tab-button-${tab}` : null}
class={{
Expand Down
3 changes: 2 additions & 1 deletion core/src/components/toggle/toggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export class Toggle implements ComponentInterface {
onClick={this.onClick}
aria-labelledby={label ? labelId : null}
aria-checked={`${checked}`}
aria-hidden={disabled ? 'true' : null}
aria-disabled={disabled ? 'true' : null}
role="switch"
class={createColorClasses(color, {
[mode]: true,
Expand All @@ -213,6 +213,7 @@ export class Toggle implements ComponentInterface {
type="checkbox"
role="switch"
aria-checked={`${checked}`}
aria-disabled={disabled ? 'true' : null}
disabled={disabled}
id={inputId}
onFocus={() => this.onFocus()}
Expand Down
Loading

0 comments on commit fec4d40

Please sign in to comment.