From 0711f8c03c2c4c743386abf490e6dddf243be5e6 Mon Sep 17 00:00:00 2001 From: Elizabeth Mitchell Date: Thu, 24 Aug 2023 16:45:22 -0700 Subject: [PATCH] fix(radio): make host radio role to fix a11y Why? role="radio" items need to be in the same DOM scope to properly announce "radio X of X" and not "radio 1 of 1" PiperOrigin-RevId: 559908996 --- docs/components/radio.md | 41 ++++-- radio/demo/demo.ts | 12 +- radio/demo/stories.ts | 128 ++++++++++-------- radio/harness.ts | 2 +- radio/internal/_radio.scss | 2 +- radio/internal/radio.ts | 89 +++++++----- radio/internal/single-selection-controller.ts | 7 +- radio/radio_test.ts | 17 +++ 8 files changed, 175 insertions(+), 123 deletions(-) diff --git a/docs/components/radio.md b/docs/components/radio.md index 6163c5a632..bbfc3c834b 100644 --- a/docs/components/radio.md +++ b/docs/components/radio.md @@ -60,7 +60,7 @@ Radios behave like elements and form a group with the same `name` attribute. Only one radio can be selected in a group. -Radios can be pre-selected by adding a `selected` attribute. +Radios can be pre-selected by adding a `checked` attribute. Add a `value` to identify which radio is selected in a form. @@ -87,7 +87,7 @@ Add a `value` to identify which radio is selected in a form.
- +
``` @@ -115,15 +115,16 @@ Associate a label with a radio using the `