Skip to content

Commit

Permalink
refactor(radio-group): use delegatesFocus
Browse files Browse the repository at this point in the history
  • Loading branch information
benelan committed Dec 15, 2022
1 parent d754b29 commit a8a10f9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/components/radio-group/radio-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ import {
@Component({
tag: "calcite-radio-group",
styleUrl: "radio-group.scss",
shadow: true
shadow: {
delegatesFocus: true
}
})
export class RadioGroup
implements LabelableComponent, FormComponent, InteractiveComponent, LoadableComponent
Expand Down Expand Up @@ -262,8 +264,7 @@ export class RadioGroup
@Method()
async setFocus(): Promise<void> {
await componentLoaded(this);

(this.selectedItem || this.getItems()[0])?.focus();
this.el.focus();
}

//--------------------------------------------------------------------------
Expand All @@ -285,7 +286,7 @@ export class RadioGroup
//--------------------------------------------------------------------------

onLabelClick(): void {
this.setFocus();
this.el.focus();
}

private getItems(): NodeListOf<HTMLCalciteRadioGroupItemElement> {
Expand Down

0 comments on commit a8a10f9

Please sign in to comment.