Skip to content

Commit

Permalink
Set tabindex
Browse files Browse the repository at this point in the history
  • Loading branch information
bjarnef committed Oct 23, 2023
1 parent 31a54f4 commit 565c269
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/uui-radio/lib/uui-radio.element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class UUIRadioElement extends LitElement {
this.setAttribute('tabindex', '0');
}
} else {
//this.setAttribute('tabindex', '-1');
this.setAttribute('tabindex', '-1');
this.setAttribute('aria-checked', 'false');
}
this.requestUpdate('checked', oldValue);
Expand All @@ -76,7 +76,7 @@ export class UUIRadioElement extends LitElement {
this._disabled = newVal;

this.setAttribute('aria-hidden', newVal ? 'true' : 'false');
//this.setAttribute('tabindex', newVal ? '-1' : '0');
this.setAttribute('tabindex', newVal ? '-1' : '0');
this.requestUpdate('disabled', oldVal);
}
private _disabled = false;
Expand Down Expand Up @@ -127,6 +127,7 @@ export class UUIRadioElement extends LitElement {
public check() {
this.checked = true;
}

/**
* Call to make the element focusable, this sets tabindex to 0.
* @method makeFocusable
Expand All @@ -136,8 +137,9 @@ export class UUIRadioElement extends LitElement {
this.setAttribute('tabindex', '0');
}
}

/**
* Call to make the element focusable, this sets tabindex to 0.
* Call to make the element focusable, this sets tabindex to -1.
* @method makeUnfocusable
*/
public makeUnfocusable() {
Expand All @@ -149,7 +151,7 @@ export class UUIRadioElement extends LitElement {
connectedCallback() {
super.connectedCallback();
//if (!this.hasAttribute('role')) this.setAttribute('role', 'radio');
//if (!this.hasAttribute('tabindex')) this.setAttribute('tabindex', '-1');
if (!this.hasAttribute('tabindex')) this.setAttribute('tabindex', '-1');
if (!this.hasAttribute('aria-checked'))
this.setAttribute('aria-checked', 'false');
}
Expand Down

0 comments on commit 565c269

Please sign in to comment.