Skip to content

Commit 6010e52

Browse files
fix(radio): also move sibling uncheck logic after root assignment
1 parent adb8d10 commit 6010e52

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

radio/internal/single-selection-controller.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ export class SingleSelectionController implements ReactiveController {
7777
this.host.addEventListener('keydown', this.handleKeyDown);
7878
this.host.addEventListener('focusin', this.handleFocusIn);
7979
this.host.addEventListener('focusout', this.handleFocusOut);
80-
if (this.host.checked) {
81-
// Uncheck other siblings when attached if already checked. This mimics
82-
// native <input type="radio"> behavior.
83-
this.uncheckSiblings();
84-
}
8580

8681
// Update siblings after a microtask to allow other synchronous connected
8782
// callbacks to settle before triggering additional Lit updates. This avoids
@@ -90,6 +85,12 @@ export class SingleSelectionController implements ReactiveController {
9085
queueMicrotask(() => {
9186
// Update for the newly added host.
9287
this.root = this.host.getRootNode() as ParentNode;
88+
if (this.host.checked) {
89+
// Uncheck other siblings when attached if already checked. This mimics
90+
// native <input type="radio"> behavior.
91+
this.uncheckSiblings();
92+
}
93+
9394
this.updateTabIndices();
9495
});
9596
}

0 commit comments

Comments
 (0)