Skip to content

Commit adb8d10

Browse files
fix(radio): move root assignment to mirror hostDisconnected
Fixes a regression caused by 688ab3c where calling hostConnected / hostDisconnected in rapid succession can cause root to become null.
1 parent 9f85b3e commit adb8d10

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

radio/internal/single-selection-controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ export class SingleSelectionController implements ReactiveController {
7474
constructor(private readonly host: SingleSelectionElement) {}
7575

7676
hostConnected() {
77-
this.root = this.host.getRootNode() as ParentNode;
7877
this.host.addEventListener('keydown', this.handleKeyDown);
7978
this.host.addEventListener('focusin', this.handleFocusIn);
8079
this.host.addEventListener('focusout', this.handleFocusOut);
@@ -90,6 +89,7 @@ export class SingleSelectionController implements ReactiveController {
9089
// connected at the same time.
9190
queueMicrotask(() => {
9291
// Update for the newly added host.
92+
this.root = this.host.getRootNode() as ParentNode;
9393
this.updateTabIndices();
9494
});
9595
}

0 commit comments

Comments
 (0)