Skip to content

Commit

Permalink
Merge pull request #4536 from christophe-g:fix-radio-click-on-navigate
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 547567268
  • Loading branch information
copybara-github committed Jul 12, 2023
2 parents 6734344 + c8b589b commit cf2dc2c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion radio/lib/single-selection-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,13 @@ export class SingleSelectionController implements ReactiveController {
}

// The next sibling should be checked, focused and dispatch a change event
nextSibling.checked = true;
nextSibling.removeAttribute('tabindex');
nextSibling.click();
nextSibling.focus();
// Fire a change event since the change is triggered by a user action.
// This matches native <input type="radio"> behavior.
nextSibling.dispatchEvent(new Event('change', {bubbles: true}));

break;
}
};
Expand Down

0 comments on commit cf2dc2c

Please sign in to comment.