When to use it#
- Use it for one question where the user must choose exactly one option and the options fit on the screen together: a period, a delivery method, a yes or no that needs more than a checkbox.
- Ask the question in the legend. Offer an answer for everyone: if “none” or “I don’t know” is valid, make it an option.
- Preselect an option only when one answer is overwhelmingly common and harmless, because residents rarely change a default.
- Not for a long list. From about 7 options a Listbox is shorter to scan.
- Not for answers that can all be true: use a CheckboxGroup.
Example#
import { Field, RadioGroup } from '@kvirn-ui/react'
import { useRadioGroupTexts } from './texts.ts'
export function DefaultRadioGroup() {
const { texts } = useRadioGroupTexts()
return (
<RadioGroup.Root name="duration">
<RadioGroup.Legend>{texts.legend}</RadioGroup.Legend>
<RadioGroup.Prose>
<p>{texts.hint}</p>
</RadioGroup.Prose>
<RadioGroup.Option>
<RadioGroup.Radio value="1" />
<Field.Label>{texts.oneMonth}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Option>
<RadioGroup.Radio value="6" />
<Field.Label>{texts.sixMonths}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Option>
<RadioGroup.Radio value="12" />
<Field.Label>{texts.twelveMonths}</Field.Label>
</RadioGroup.Option>
</RadioGroup.Root>
)
}Use cases#
Keep the choice in your form state
Your form library or reducer owns the value. Give the group the chosen value and store the one it reports. The group never stores it. Pass null, not undefined, to say the group is controlled and nothing is chosen.
You chose: nothing
import { Field, RadioGroup } from '@kvirn-ui/react'
import { useState } from 'react'
import { useRadioGroupTexts } from './texts.ts'
export function ControlledRadioGroup() {
const { texts } = useRadioGroupTexts()
// This state stands in for your form library: `null` means controlled with nothing chosen.
const [duration, setDuration] = useState<string | null>(null)
return (
<div>
<RadioGroup.Root name="duration" value={duration} onValueChange={setDuration}>
<RadioGroup.Legend>{texts.legend}</RadioGroup.Legend>
<RadioGroup.Option>
<RadioGroup.Radio value="1" />
<Field.Label>{texts.oneMonth}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Option>
<RadioGroup.Radio value="6" />
<Field.Label>{texts.sixMonths}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Option>
<RadioGroup.Radio value="12" />
<Field.Label>{texts.twelveMonths}</Field.Label>
</RadioGroup.Option>
</RadioGroup.Root>
<p>
{texts.youChose}: {duration ?? texts.nothing}
</p>
</div>
)
}Props in this example:
valueon RadioGroup.RootonValueChangeon RadioGroup.Rootvalueon RadioGroup.Radio
Information: Did you know?
The arrow keys check the radio they move to, so nothing slow or harmful may happen on change. Leave the page change, the save and the submit to a button.
A plain form with no state
Without value the radios are native and uncontrolled. Set which one starts checked with defaultValue, and give the group a name. A form submit then sends the chosen value under that name.
import { Button, Field, RadioGroup } from '@kvirn-ui/react'
import { useState } from 'react'
import { useRadioGroupTexts } from './texts.ts'
export function PlainFormRadioGroup() {
const { texts } = useRadioGroupTexts()
const [sent, setSent] = useState<string | undefined>(undefined)
return (
<form
onSubmit={(event) => {
event.preventDefault()
const duration = new FormData(event.currentTarget).get('duration')
setSent(typeof duration === 'string' ? duration : undefined)
}}
>
<RadioGroup.Root name="duration" defaultValue="6">
<RadioGroup.Legend>{texts.legend}</RadioGroup.Legend>
<RadioGroup.Option>
<RadioGroup.Radio value="1" />
<Field.Label>{texts.oneMonth}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Option>
<RadioGroup.Radio value="6" />
<Field.Label>{texts.sixMonths}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Option>
<RadioGroup.Radio value="12" />
<Field.Label>{texts.twelveMonths}</Field.Label>
</RadioGroup.Option>
</RadioGroup.Root>
<Button type="submit" className="kv-button--primary">
{texts.send}
</Button>
{sent === undefined ? null : (
<p>
{texts.sent}: {sent}
</p>
)}
</form>
)
}Props in this example:
defaultValueon RadioGroup.Rootnameon RadioGroup.Root
Explain one option
A short text about one option goes in that option’s RadioGroup.Option as a Field.HelpText, directly under its label, and is read with that radio. Text about the whole group goes in RadioGroup.HelpText under the options. A description to read before answering goes in RadioGroup.Prose above them.
import { Field, RadioGroup } from '@kvirn-ui/react'
import { useRadioGroupTexts } from './texts.ts'
export function OptionHelpTextRadioGroup() {
const { texts } = useRadioGroupTexts()
return (
<RadioGroup.Root name="duration">
<RadioGroup.Legend>{texts.legend}</RadioGroup.Legend>
<RadioGroup.Option>
<RadioGroup.Radio value="1" />
<Field.Label>{texts.oneMonth}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Option>
<RadioGroup.Radio value="6" />
<Field.Label>{texts.sixMonths}</Field.Label>
<Field.HelpText>{texts.sixMonthsHelp}</Field.HelpText>
</RadioGroup.Option>
<RadioGroup.Option>
<RadioGroup.Radio value="12" />
<Field.Label>{texts.twelveMonths}</Field.Label>
</RadioGroup.Option>
<RadioGroup.HelpText>{texts.groupHelp}</RadioGroup.HelpText>
</RadioGroup.Root>
)
}One question on a page
When a page asks one question, the legend can be the page’s heading. Put the heading inside the legend and add the class kv-fieldset-legend--heading, which gives it the size of a page heading. Use h1 if it is the page’s main heading. This example is inside a page that already has one, so it uses h2. When the person presses Continue with nothing chosen, show an error, as in Say what is wrong when nothing is chosen.
import { Button, Field, RadioGroup } from '@kvirn-ui/react'
import { useRadioGroupTexts } from './texts.ts'
export function PageHeadingRadioGroup() {
const { texts } = useRadioGroupTexts()
return (
// On your site, sending the form goes on to the next page.
<form onSubmit={(event) => event.preventDefault()}>
<RadioGroup.Root name="applicant" required>
<RadioGroup.Legend className="kv-fieldset-legend--heading">
<h2>{texts.applicantHeading}</h2>
</RadioGroup.Legend>
<RadioGroup.Prose>
<p>{texts.applicantProse}</p>
</RadioGroup.Prose>
<RadioGroup.Option>
<RadioGroup.Radio value="self" />
<Field.Label>{texts.applicantSelf}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Option>
<RadioGroup.Radio value="someone-else" />
<Field.Label>{texts.applicantSomeoneElse}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Option>
<RadioGroup.Radio value="organisation" />
<Field.Label>{texts.applicantOrganisation}</Field.Label>
</RadioGroup.Option>
</RadioGroup.Root>
<Button type="submit" className="kv-button--primary">
{texts.continue}
</Button>
</form>
)
}Props in this example:
requiredon RadioGroup.Root
Information: Did you know?
Set required on the group, as here. Without it the legend adds “(optional)” after your heading, so a question the person must answer looks optional (3.3.2 Labels or Instructions).
Say what is wrong when nothing is chosen
Check the answer when the user sends the form. Set invalid and render a RadioGroup.ErrorMessage that says what to do. The error is read as part of the group’s description, because a radio can’t be marked invalid. required removes “(optional)” from the legend, but a group can’t be announced as required, so say once, before the first question, that every question must be answered unless it says “(optional)”.
import { Button, Field, RadioGroup } from '@kvirn-ui/react'
import { useEffect, useRef, useState } from 'react'
import { useRadioGroupTexts } from './texts.ts'
export function ErrorOnSubmitRadioGroup() {
const { texts } = useRadioGroupTexts()
const [duration, setDuration] = useState<string | null>(null)
const [attempts, setAttempts] = useState(0)
const formRef = useRef<HTMLFormElement>(null)
const isInvalid = attempts > 0 && duration === null
// The group never moves focus: after a failed submit, you move it to the first radio.
useEffect(() => {
if (attempts > 0) {
formRef.current?.querySelector('input')?.focus()
}
}, [attempts])
return (
<form
ref={formRef}
noValidate
onSubmit={(event) => {
event.preventDefault()
if (duration === null) {
setAttempts((count) => count + 1)
}
}}
>
<p>{texts.allRequired}</p>
<RadioGroup.Root
name="duration"
required
invalid={isInvalid}
value={duration}
onValueChange={setDuration}
>
<RadioGroup.Legend>{texts.legend}</RadioGroup.Legend>
<RadioGroup.Option>
<RadioGroup.Radio value="1" />
<Field.Label>{texts.oneMonth}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Option>
<RadioGroup.Radio value="6" />
<Field.Label>{texts.sixMonths}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Option>
<RadioGroup.Radio value="12" />
<Field.Label>{texts.twelveMonths}</Field.Label>
</RadioGroup.Option>
<RadioGroup.ErrorMessage>{texts.errorMissing}</RadioGroup.ErrorMessage>
</RadioGroup.Root>
<Button type="submit" className="kv-button--primary">
{texts.send}
</Button>
</form>
)
}Props in this example:
Warning: Don't forget
The group never moves focus. After a failed submit, move it to the first radio or to an ErrorSummary, as in What you need to do.
Say why an answer was not accepted
Sometimes a person answers, but you can’t accept the answer, and you only find out after they send the form. Here the chosen way to get a decision is not set up. After the check, set invalid on the group and render a RadioGroup.ErrorMessage that names the reason and says what to do next. Also show an ErrorSummary whose link goes to the group’s first option: give that option a controlId and use the same id in the link. As above, the error is read with the group’s description, because a radio can’t be marked invalid. If you know before the person chooses, disable the option and say why, as in One option isn’t available.
import { Button, ErrorSummary, Field, RadioGroup, Stack } from '@kvirn-ui/react'
import { useId, useState } from 'react'
import { useRadioGroupTexts } from './texts.ts'
export function InvalidRadioGroup() {
const { texts } = useRadioGroupTexts()
const idPrefix = useId()
// A group of options is linked by the id of its first option.
const firstOptionId = `${idPrefix}-post`
const [choice, setChoice] = useState<string | null>(null)
const [problem, setProblem] = useState<{ choice: string | null; text: string } | null>(null)
const [submitCount, setSubmitCount] = useState(0)
const [isSent, setIsSent] = useState(false)
// The error belongs to the answer that was refused: choosing another one clears it.
const isInvalid = problem !== null && choice === problem.choice
return (
<Stack className="kv-stack--gap-8">
{isInvalid ? (
<ErrorSummary.Root focusKey={submitCount}>
{/* The docs page already has an h1, so the summary's title is an h4. On your pages the default is h2. */}
<ErrorSummary.Title as="h4" />
<ErrorSummary.List>
<ErrorSummary.Item>
<ErrorSummary.Link controlId={firstOptionId}>{problem.text}</ErrorSummary.Link>
</ErrorSummary.Item>
</ErrorSummary.List>
</ErrorSummary.Root>
) : null}
<form
noValidate
onSubmit={(event) => {
event.preventDefault()
// This stands in for the check your server makes after the send.
const text =
choice === null
? texts.decisionMissing
: choice === 'mailbox'
? texts.decisionNoMailbox
: null
setProblem(text === null ? null : { choice, text })
setIsSent(text === null)
setSubmitCount((count) => count + 1)
}}
>
<p>{texts.allRequired}</p>
<RadioGroup.Root
name="decision"
required
invalid={isInvalid}
value={choice}
onValueChange={setChoice}
>
<RadioGroup.Legend>{texts.decisionLegend}</RadioGroup.Legend>
<RadioGroup.Option controlId={firstOptionId}>
<RadioGroup.Radio value="post" />
<Field.Label>{texts.decisionPost}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Option>
<RadioGroup.Radio value="email" />
<Field.Label>{texts.decisionEmail}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Option>
<RadioGroup.Radio value="mailbox" />
<Field.Label>{texts.decisionMailbox}</Field.Label>
</RadioGroup.Option>
<RadioGroup.ErrorMessage>{problem?.text}</RadioGroup.ErrorMessage>
</RadioGroup.Root>
<Button type="submit" className="kv-button--primary">
{texts.send}
</Button>
</form>
<output>{isSent ? texts.sent : null}</output>
</Stack>
)
}Props in this example:
Warning: Don't forget
Use the same words in the summary and under the group. Name the reason and say what to do next (3.3.1 Error Identification, 3.3.3 Error Suggestion).
One option isn’t available
Tab and the arrow keys skip a disabled radio (the browser does this). A screen reader can still reach it when reading the page, and tells the user it can't be used (each screen reader words it differently). So say why in visible help text next to it, with what the person can do. To disable every option, set disabled on the group.
import { Field, RadioGroup } from '@kvirn-ui/react'
import { useRadioGroupTexts } from './texts.ts'
export function DisabledOptionRadioGroup() {
const { texts } = useRadioGroupTexts()
return (
<RadioGroup.Root name="duration" defaultValue="12">
<RadioGroup.Legend>{texts.legend}</RadioGroup.Legend>
<RadioGroup.Option>
<RadioGroup.Radio value="12" />
<Field.Label>{texts.twelveMonths}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Option>
<RadioGroup.Radio value="24" disabled />
<Field.Label>{texts.unavailable}</Field.Label>
<Field.HelpText>{texts.unavailableHelp}</Field.HelpText>
</RadioGroup.Option>
</RadioGroup.Root>
)
}Props in this example:
disabledon RadioGroup.Radio
Let people answer “Other” in their own words
A free-text answer belongs to the option it qualifies, and it is only asked when it is needed. The text field appears when “Other” is chosen, so people who pick another option don’t see it.
import { Field, RadioGroup, TextInput } from '@kvirn-ui/react'
import { useRadioGroupTexts } from './texts.ts'
export function OtherOptionRadioGroup() {
const { texts } = useRadioGroupTexts()
return (
<RadioGroup.Root name="source">
<RadioGroup.Legend>{texts.sourceLegend}</RadioGroup.Legend>
<RadioGroup.Option>
<RadioGroup.Radio value="letter" />
<Field.Label>{texts.sourceLetter}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Option>
<RadioGroup.Radio value="colleague" />
<Field.Label>{texts.sourceColleague}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Option>
<RadioGroup.Radio value="other" />
<Field.Label>{texts.sourceOther}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Reveal value="other">
<Field.Root>
<Field.Label>{texts.sourceSpecify}</Field.Label>
<TextInput name="source-other" />
</Field.Root>
</RadioGroup.Reveal>
</RadioGroup.Root>
)
}Props in this example:
When “Other” is checked, the text field appears right after it. A screen reader says An input field has appeared below.
once, politely, and reads the radio with 1 control
. That sentence is the default text of radioGroup.revealShown (see Strings). Everything else it says is under What a screen reader reads.
Warning: Don't forget
A plain form still sends what was typed as source-other, so ignore it on the server. Give the field a label of its own, and make it required only while “Other” is chosen.
Tell several “Other” questions apart by their announcement
When someone checks “Other”, a screen reader says that a field has appeared, right after it reads the radio. In English the default text is “An input field has appeared below.”, and it follows the language of the page. That is enough for one group. When a page has several, give each Reveal its own text that names its field, as below, so the person hears which one opened. Every group announces, also when you check them one after the other. See What a screen reader reads.
import { Field, RadioGroup, Stack, TextInput } from '@kvirn-ui/react'
import { useRadioGroupTexts } from './texts.ts'
export function AnnouncementWordingRadioGroup() {
const { texts } = useRadioGroupTexts()
return (
<Stack className="kv-stack--gap-8">
<RadioGroup.Root name="heard-from">
<RadioGroup.Legend>{texts.sourceLegend}</RadioGroup.Legend>
<RadioGroup.Option>
<RadioGroup.Radio value="letter" />
<Field.Label>{texts.sourceLetter}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Option>
<RadioGroup.Radio value="colleague" />
<Field.Label>{texts.sourceColleague}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Option>
<RadioGroup.Radio value="other" />
<Field.Label>{texts.sourceOther}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Reveal value="other" messages={{ revealShown: texts.revealHeardFrom }}>
<Field.Root>
<Field.Label>{texts.heardFromSpecify}</Field.Label>
<TextInput name="heard-from-other" />
</Field.Root>
</RadioGroup.Reveal>
</RadioGroup.Root>
<RadioGroup.Root name="reply-by">
<RadioGroup.Legend>{texts.replyLegend}</RadioGroup.Legend>
<RadioGroup.Option>
<RadioGroup.Radio value="email" />
<Field.Label>{texts.replyEmail}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Option>
<RadioGroup.Radio value="letter" />
<Field.Label>{texts.replyLetter}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Option>
<RadioGroup.Radio value="other" />
<Field.Label>{texts.sourceOther}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Reveal value="other" messages={{ revealShown: texts.revealReplyBy }}>
<Field.Root>
<Field.Label>{texts.replyBySpecify}</Field.Label>
<TextInput name="reply-by-other" />
</Field.Root>
</RadioGroup.Reveal>
</RadioGroup.Root>
</Stack>
)
}Props in this example:
Information: Implement like this
To use one text for the whole site, pass it to the provider, as below. Write it in the language of the page: for another language, start from that language’s catalog instead of en. An empty text is ignored, so the default is used. Locales explains the rest.
import { defineMessages } from '@kvirn-ui/i18n'
import { en } from '@kvirn-ui/i18n/en'
// The text it replaces: en.radioGroup.revealShown
const messages = defineMessages(en, {
radioGroup: { revealShown: 'A box for your own words has opened below.' },
})
<KvirnProvider messages={messages}>{/* your site */}</KvirnProvider>A denser group for staff screens
A caseworker who records many decisions a day can fit more on the screen. Put the class kv-compact on the form, on any container around the group, or on <html> for a whole staff tool. It is a class, not a prop. From a window 64rem wide (1024 pixels at the browser’s default text size), option rows are 32px high instead of 44px, the legend and option labels are 14px instead of 16px, options are 4px apart instead of 8px, and questions are 16px apart instead of 24px. In a narrower window nothing changes, because touch is likely there. The circle stays at least 24 by 24 pixels, and the description and error text stay 16px.
import { Field, RadioGroup } from '@kvirn-ui/react'
import { useRadioGroupTexts } from './texts.ts'
export function CompactRadioGroup() {
const { texts } = useRadioGroupTexts()
return (
<div className="kv-compact">
<RadioGroup.Root name="decision" required>
<RadioGroup.Legend>{texts.caseLegend}</RadioGroup.Legend>
<RadioGroup.Prose>
<p>{texts.caseProse}</p>
</RadioGroup.Prose>
<RadioGroup.Option>
<RadioGroup.Radio value="approve" />
<Field.Label>{texts.caseApprove}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Option>
<RadioGroup.Radio value="partly" />
<Field.Label>{texts.casePartly}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Option>
<RadioGroup.Radio value="reject" />
<Field.Label>{texts.caseReject}</Field.Label>
</RadioGroup.Option>
<RadioGroup.Option>
<RadioGroup.Radio value="more-information" />
<Field.Label>{texts.caseMoreInformation}</Field.Label>
</RadioGroup.Option>
</RadioGroup.Root>
</div>
)
}Information: Did you know?
Compact rows meet 2.5.8 Target Size (Minimum) (AA), but not the 44px of 2.5.5 Target Size (Enhanced) (AAA). Keep services for residents at the default size.
Accessibility#
What it does for you#
- APG pattern: Radio Group. Native:
<input type="radio">elements that share anamealready give the pattern's keys (one Tab stop, arrows move and check, Space checks) and its roles, so no ARIA and no key handler are added. The group is a<fieldset>with a<legend>instead ofrole="radiogroup". - Deviations: none from APG. Design decisions: the group is a Fieldset, option labels carry no optional marker, no
aria-invalidon radios, and the group holds no form state. - Native elements used:
<fieldset>and<legend>(RadioGroup.RootandRadioGroup.Legend),<input type="radio">(RadioGroup.Radio),<label for>(Field.Label).
A RadioGroup is one question with exactly one answer ("How long do you need the permit?": 1, 6 or 12 months). RadioGroup.Root renders the <fieldset> and acts as a Fieldset.Root with group set; RadioGroup.Radio is a native radio. It holds no form state: the selected value is the value prop, and each change is reported up.
| Part | Element / role | ARIA / state | Notes |
|---|---|---|---|
| RadioGroup.Root | <fieldset> → group | As Fieldset: aria-describedby = descriptions, then the error. Native disabled. data-invalid, data-required, data-disabled. No aria-invalid and no aria-required | Classes kv-radio-group kv-fieldset. Props: name (generated when missing), value, defaultValue, onValueChange(value, { reason: 'input', event }), invalid, required, disabled, messages, and every fieldset prop. The root is always a <fieldset> |
| RadioGroup.Legend | <legend>, the group's name | As in the Fieldset page | Ends with the optional text in a group that isn't required: "(optional)" in the default locale en, and each language has its own |
| RadioGroup.Option | <div> with an <input type="radio"> and its label | The option's name is its label. No optional marker on an option. The option's own help text (a Field.HelpText in its Option, outside the label) is in that radio's aria-describedby. Native checked, native grouping by name. data-state when controlled | An Option has class kv-option, no kv-field, no error message and marker="none"; disabled disables its radio. Field.Root around a radio still works. The radio gets the group's name, checked from value, and value from its prop |
| RadioGroup.Radio | <input type="radio"> → radio | data-state="checked" | "unchecked" only when the radio is controlled (the group has a value, so the state is known from props; an uncontrolled radio has none: style :checked), data-invalid and data-disabled (styling only). No data-focus-visible: focus is the native :focus-visible. Never aria-invalid, not even when its Field is invalid. aria-controls = the id of its RadioGroup.Reveal while one is mounted. No aria-required | Class kv-radio. Props: value (required), disabled, onCheckedChange is not offered (use the group's onValueChange), and every native input prop. It must be a direct child of RadioGroup.Option (or Field.Root), before the label |
| RadioGroup.Reveal | <div> (or <section> via as), no role | Stable id, hidden until the radio with its value is checked, data-state="open" | "closed". Its Fields keep their own marker and required state, and their help text is not in the group's description | Class kv-radio-group-reveal. Props: value (required), as, messages (radioGroup.revealShown) and native div props. Put it right after its radio's RadioGroup.Option. Never unmounted |
useRadioGroup | the logic, for your own fieldset | returns name, getRadioProps(value), getRevealProps(value), registerReveal(value), consumeUserChoice(value), resetSelection() | Options: name, value, defaultValue, onValueChange, invalid, disabled. It holds UI state only (the value that decides which reveal shows). Use it with useFieldset({ group: true }) and your own markup |
useRadio | the same attributes, for your own elements | inputProps, isChecked, isInvalid, isDisabled. No isFocusVisible | Spread inputProps on your <input type="radio"> |
Rules, tested in radio-group.test.tsx:
- The group is named by its legend and described by its help text and error (
radio-group.test.tsx › the group is named by its legend and described by its help text and error). The description is aRadioGroup.Proseabove the options and the help text aRadioGroup.HelpTextunder them (theFieldset.HelpTextunder the group's name): the description is the text content, so keep both short and plain, and a help text has no links. A Prose or HelpText directly in the group describes the group, one inside an option's Option describes that radio, and a Prose that isn't a description goes outside the group. An option's help text is aField.HelpTextin the option'sRadioGroup.Option, in the small text size, directly under the label and outside the click target (radio-group.test.tsx › an option help text is a Field.HelpText in that RadioGroup.Option, outside its label, and has no axe violations).RadioGroup.HelpTextis listed after the description and before the error (radio-group.test.tsx › RadioGroup.HelpText is the group’s help text: after the description, before the error). - One name, native grouping. Every radio has the group's
name, so the browser groups them. Withoutname, the group generates one (useId) (radio-group.test.tsx › every radio gets the group’s name, generated when missing). - Controlled by
value. The radio whosevalueequals the group'svalueis checked.nullmeans "controlled, nothing selected". A change callsonValueChange(value, { reason: 'input', event })with the radio's value. The group never stores it (radio-group.test.tsx › a controlled group checks the radio whose value it is given). - Uncontrolled without
value.defaultValuesetsdefaultCheckedon one radio; the browser keeps the state and a form submit sends it (radio-group.test.tsx › uncontrolled: defaultValue and the form submit). - No
aria-invalidon radios (ARIA 1.2 doesn't support it onradio). An invalid group setsdata-invalidon the fieldset, its parts and every radio, so the theme can draw a thicker edge that does not rely on colour; the error reaches users through the fieldset'saria-describedby(radio-group.test.tsx › invalid styles every radio and sets no aria-invalid). requiredremoves the optional text (inen, "(optional)") from the legend and setsdata-required. Noaria-required(not supported ongrouporradio); see Known issues.disabledon the group is nativefieldset[disabled]. A single disabledRadiois skipped by Tab and by the arrow keys (native) (radio-group.test.tsx › a disabled radio is natively disabled). This is native radio behaviour, as the APG keyboard practice expects: anaria-disabledradio would be checked by the browser's own arrow keys. Put the reason in the option's help text.RadioGroup.Reveal(the "Other, please specify" field).<RadioGroup.Reveal value="other">follows its radio'sRadioGroup.Optionin the DOM and ishiddenuntil the radio with thatvalueis checked, so the field is next in the reading and Tab order (1.3.2) (radio-group.test.tsx › the reveal is hidden until its radio is checked,radio-group.test.tsx › the reveal follows its radio’s option in DOM order). It is never unmounted: the typed text survives switching options (radio-group.test.tsx › checking another radio hides the reveal again and keeps what was typed) and a plain form still submits it, so ignore or clear it on the server when its radio is not the chosen one.- The radio points at the reveal. While a Reveal for it is mounted the radio has
aria-controlswith the Reveal's id; the id is stable, so it never points at nothing. Noaria-expanded: not supported onradio(radio-group.test.tsx › the radio points at the reveal with aria-controls, the others do not). - Focus never moves. Choosing the radio does not move focus into the field (3.2.2); the arrow keys keep moving through the radios (
radio-group.test.tsx › focus stays on the radio when the field appears). - Selected value for the reveal. Controlled: the group's
value. Uncontrolled: the group mirrors the radio the user chose (starting fromdefaultValue) as UI state only, and goes back todefaultValuewhen the surrounding<form>resets (radio-group.test.tsx › a form reset removes the field from the reading order). - No key handler. Roving focus, wrapping and checking on arrow keys are the browser's, and tested in the Keyboard table below (for example
radio-group.test.tsx › Tab leaves the group after one stopandradio-group.test.tsx › ArrowDown and ArrowRight move to the next radio and check it, wrapping). No page handler cancels a key.
It announces nothing.
What you need to do#
- A
RadioGroup.Legendthat asks the question, first in the Root; aRadioGroup.Optionwith a direct-childRadioGroup.Radioand aField.Labelper option; avalueon every Radio. - Offer an answer for everyone. If "none" or "I don't know" is valid, it's an option; the group has no deselect.
- Preselecting an option is a decision with consequences (residents rarely change a default): do it only when one answer is overwhelmingly common and harmless.
- Pass
valueandonValueChangefrom your form state, ordefaultValueandnamefor a plain<form>. - Set
invalidand render aRadioGroup.ErrorMessage. On submit, move focus to the checked radio or the first one of an invalid group (or to the ErrorSummary). - With a
RadioGroup.Reveal, put it right after its radio'sRadioGroup.Option, give its field a label of its own, and make the field required only while its radio is chosen. A hidden field is still submitted: ignore or clear it when another option is chosen. - Don't use a radio group for a long list: from about 7 options, a Listbox is shorter to scan.
- Say once, before the first question, that every question must be answered unless it says it is optional (in
en: "Every question must be answered unless it says (optional)"), per 3.3.2 Labels or Instructions (A).
Warning: Don't forget
Ask the question in the legend, and give every radio a value and a label. Without the legend a screen reader reads the options with no question (1.3.1 Info and Relationships, 3.3.2 Labels or Instructions).
Visual and modes#
- Focus indicator: the default theme draws an outline around the circle, at least 2px thick, with at least 3:1 contrast against its background (2.4.7 Focus Visible, AA). Keep it if you restyle.
- Target size: the circle is at least 24 by 24 CSS pixels (2.5.8 Target Size (Minimum), AA). The whole row is the click target: the label spans the row, and the row is taller in comfortable density than in compact density.
- Colour: the circle has an edge with at least 3:1 contrast against the page (1.4.11 Non-text Contrast, AA). Checked is a dot inside a ring, so the shape carries the state, not only colour (1.4.1 Use of Color, A). Invalid is a thicker edge plus the error message. Disabled is a dashed edge, and a checked disabled radio keeps its dot in the muted text colour.
- forced-colors behaviour (a mode where the system chooses the colours): the dot is drawn as a filled shape, and the colours are set explicitly: a checked radio uses the system's highlight colour for its edge and dot, an invalid one a thicker edge in the system's text colour, and a disabled one the system's greyed-out text colour.
- The Reveal has an inline-start bar and indent that tie it to its radio; a border stays visible in forced colours. It does not animate.
- reduced-motion behaviour: the edge and fill change with a transition only when motion is allowed; the dot appears instantly.
- RTL (right-to-left text): the circles are at the right of their labels; the arrow keys are mirrored by the browser (see Keyboard).
Focus management#
- Initial focus: not moved.
- Trap: no.
- Restore to: not applicable.
- On error: the group never moves focus. An ErrorSummary moves focus to itself; without one, the consumer moves focus to the checked radio, or the first one, of the invalid group.
- Never obscured by: nothing around the circles clips the focus ring (2.4.11 Focus Not Obscured (Minimum), AA).
WCAG success criteria#
- 1.3.1 Info and Relationships (A), 4.1.2 Name, Role, Value (A): native radios grouped by
name, in a fieldset with a legend. - 1.3.2 Meaningful Sequence (A): a
RadioGroup.Revealfollows its radio in the DOM. 4.1.3 Status Messages (AA): the field's appearance is announced politely. - 1.4.1 Use of Color (A), 1.4.11 Non-text Contrast (AA): the dot's shape, the edge, the invalid width.
- 2.1.1 Keyboard (A), 2.4.3 Focus Order (A), 3.2.2 On Input (A): one Tab stop, arrows, Space, no context change.
- 2.4.7 Focus Visible (AA), 2.4.11 Focus Not Obscured (Minimum) (AA), 2.4.13 Focus Appearance (AAA, not counted toward the AA bar).
- 2.5.3 Label in Name (A), 2.5.8 Target Size (Minimum) (AA).
- 3.3.1 Error Identification (A), 3.3.2 Labels or Instructions (A), 3.3.3 Error Suggestion (AA): the legend asks, the help text helps, the error says what to do.
Keyboard#
- Focus
- native
- Selection follows focus
- yes (native: an arrow key moves focus and checks the radio; instant and harmless, as the APG allows)
- Arrows wrap
- yes (native: from the last radio back to the first, and the reverse)
- Shortcuts
- none
The group is one Tab stop (a composite widget). The browser's own roving is used instead of tabindex: the checked radio, or the first (last, going backwards) when none is checked, is the stop. Home and End do nothing; they are not part of the APG radio group.
| Key | Where | What happens |
|---|---|---|
| Tab | before the group, none checked | Moves focus to the first radio. The rest of the group is skipped Test: radio-group.test.tsx › Tab enters the group at the first radio when none is checked |
| Tab | before the group, one checked | Moves focus to the checked radio Test: radio-group.test.tsx › Tab enters the group at the checked radio |
| Tab | on a radio | Leaves the group, to the next focusable element. A controlled group stays one Tab stop after an arrow key Test: radio-group.test.tsx › Tab leaves the group after one stop, radio-group.test.tsx › a controlled group is still one Tab stop after an arrow key |
| Shift+Tab | after the group, none checked | Moves focus to the last radio Test: radio-group.test.tsx › Shift+Tab enters the group at the last radio when none is checked |
| Shift+Tab | on a radio | Leaves the group, to the previous focusable element Test: radio-group.test.tsx › Shift+Tab leaves the group after one stop |
| ArrowDown / ArrowRight | on a radio | Moves focus to the next radio and checks it. From the last it wraps to the first. Right is the next in left-to-right text, and Left in right-to-left (the browser mirrors it) Test: radio-group.test.tsx › ArrowDown and ArrowRight move to the next radio and check it, wrapping, radio-group.test.tsx › right to left: ArrowLeft moves to the next radio and ArrowRight to the previous |
| ArrowUp / ArrowLeft | on a radio | Moves focus to the previous radio and checks it. From the first it wraps to the last. Left is the previous in left-to-right text, and Right in right-to-left Test: radio-group.test.tsx › ArrowUp and ArrowLeft move to the previous radio and check it, wrapping, radio-group.test.tsx › right to left: ArrowLeft moves to the next radio and ArrowRight to the previous |
| ArrowDown / ArrowUp | next radio is disabled | Skips the disabled radio (native) Test: radio-group.test.tsx › Arrow keys skip a disabled radio |
| ArrowDown / ArrowUp | a revealed field follows the radio | Moves to the next or previous radio, not into the revealed field Test: radio-group.test.tsx › ArrowDown moves from the radio to the next radio, not into the revealed field, radio-group.test.tsx › ArrowUp moves from the second radio back to the first, past the revealed field |
| Tab | on a radio, its reveal hidden | Leaves the group; the hidden field is skipped Test: radio-group.test.tsx › Tab from the checked radio skips the hidden reveal field and leaves the group |
| Tab | on a radio with a revealed field | Moves focus into the revealed field; the next Tab continues after the group Test: radio-group.test.tsx › Tab from the checked radio reaches the revealed field, radio-group.test.tsx › Tab from the revealed field continues after the group |
| Shift+Tab | in the revealed field | Moves focus back to the checked radio Test: radio-group.test.tsx › Shift+Tab from the revealed field returns to the radio |
| Space | on an unchecked radio | Checks the focused radio. On a checked radio it does nothing (native) Test: radio-group.test.tsx › Space checks the focused radio |
Arrow keys check the radio they move to, so the page must not do anything harmful or slow on change (3.2.2 On Input, A). A native radio's change event is instant. Clicking the label, or the padding around the circle, checks and focuses the radio (radio-group.test.tsx › clicking the label text selects the radio).
Announcements#
What a screen reader reads#
| State or action | Read aloud | Politeness | Test |
|---|---|---|---|
| Enter the group | group, How did you hear about us? (optional), radio, Other, not checked, 1 control, … | none | radio-group.test.tsx › entering the group reads the radios, the controlling one with its control, and no field |
| Check Other | radio, Other, checked, 1 control, position 2, set size 2, then An input field has appeared below. | polite | radio-group.test.tsx › it is announced politely, exactly once, when the user checks the radio, radio-group.test.tsx › after checking Other the field is read straight after its radio, radio-group.test.tsx › the field reads its label and optional marker as a textbox (the checked radio's phrase) |
| Tab into the field | textbox, Describe (optional) | none | radio-group.test.tsx › the field reads its label and optional marker as a textbox |
| Check another option | nothing; the field leaves the reading order | none | radio-group.test.tsx › checking another option removes the field from the reading order |
| Form reset | nothing; the field leaves the reading order | none | radio-group.test.tsx › a form reset removes the field from the reading order |
| Mount with Other already checked | textbox, Describe (optional), and nothing live | none | radio-group.test.tsx › it is not announced on mount with a checked radio |
API reference#
import { Field, RadioGroup, useRadio, useRadioGroup } from '@kvirn-ui/react'RadioGroup.Root
Renders <fieldset>, which a screen reader announces as a group. It is a Fieldset.Root with group set, takes every attribute of a <fieldset> and passes ref to it. Its options are RadioGroup.Option parts, each with a RadioGroup.Radio and its label. The default theme is described on Theming.
| Prop | Type | Default | Description |
|---|---|---|---|
name | string | generated | The name every radio shares, so the browser groups them and a form submit sends the choice. |
value | string | null | – | Controlled: the value of the checked radio, from your form state. null means controlled with nothing chosen. |
defaultValue | string | – | Uncontrolled: the value checked at the start. The browser keeps the state after that. |
onValueChange | (value: string, details: { reason: "input"; event }) => void | – | Called with the value of the radio the user chose. The group never stores it. |
invalid | boolean | false | Marks the group and every radio with data-invalid, and shows the ErrorMessage. A radio never gets aria-invalid. |
required | boolean | false | Sets data-required and removes the optional text from the legend. Neither a group nor a radio has aria-required, so say what is required in the legend. |
disabled | boolean | false | Native fieldset disabled: every radio is disabled and skipped by Tab and the arrow keys. Every radio also gets data-disabled. |
messages | Partial<KvirnMessages["field"]> | – | Overrides the legend’s optional text and the error prefix for this group. |
| Class or attribute | Values | Meaning |
|---|---|---|
kv-radio-group | always | The part class. It sits next to kv-fieldset. |
kv-fieldset | always | The fieldset class the default theme styles. |
data-invalid | present or absent | The group is invalid. Also on the legend, the help text, the error and every radio. |
data-required | present or absent | The group is required. Also on the legend. |
data-disabled | present or absent | The group is disabled. Also on every radio. |
aria-describedby | ids | Set for you: every description and help text in DOM order, then the error. Your own ids come after. |
RadioGroup.Option
Renders <div> (or <li>) around one answer: its radio, its Field.Label and its Field.HelpText. It has no “(optional)” marker and no error message of its own: those belong to the question.
| Prop | Type | Default | Description |
|---|---|---|---|
disabled | boolean | false | Disables this option’s control. Its label and help text get data-disabled. To disable every option, set disabled on the group. |
controlId | string | generated | The control’s id. Set it to link to the option from an error summary; the label, help text and control stay wired to it. |
as | "div" | "li" | "div" | The element to render. Use li when the options are a list, and then put the options in a <ul role="list"> inside the group, after the legend, so a screen reader announces the list. |
| Class or attribute | Values | Meaning |
|---|---|---|
kv-option | always | The part class. The default theme styles it. |
data-disabled | present or absent | The option is disabled. |
RadioGroup.Radio
Renders <input type="radio"> with the role radio. It takes every attribute of an <input> and passes ref to it. Put it directly in a RadioGroup.Option, before the label. It never has aria-invalid or aria-required: ARIA doesn’t support them on a radio.
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | – | What a form submit sends when this radio is checked, and its value inside the group. Give every radio one. |
checked | boolean | – | Outside a RadioGroup only. In a group, the group’s value sets it. |
defaultChecked | boolean | – | Outside a RadioGroup only. In a group, the group’s defaultValue sets it. |
disabled | boolean | false | Native disabled: this radio is skipped by Tab and the arrow keys. |
| Class or attribute | Values | Meaning |
|---|---|---|
kv-radio | always | The part class. The default theme styles it. |
data-state | "checked" or "unchecked" | Only when the checked state is known from props. For an uncontrolled radio, style :checked. |
data-invalid | present or absent | The group or the Field is invalid. |
data-disabled | present or absent | The radio, the group or the Field is disabled. |
RadioGroup.Reveal
Renders <div> (or <section>) that holds what belongs to one radio, such as an “Other, please specify” field. Put it right after that radio’s RadioGroup.Option. It is hidden until the radio is checked, is never unmounted, and never moves focus. The radio gets aria-controls. When someone checks the radio, a screen reader says “An input field has appeared below.” politely (see Strings to change the text). The typed text is still submitted by a plain form: ignore or clear it on the server.
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | Required | The value of the radio this content belongs to. It is shown when that radio is checked. |
messages | Partial<KvirnMessages["radioGroup"]> | Required | Overrides the announcement ("an input field has appeared below") for this instance. |
as | "div" | "section" | "div" | The element to render. |
| Class or attribute | Values | Meaning |
|---|---|---|
kv-radio-group-reveal | always | The part class. The default theme styles it. |
id | always | Stable, and the radio’s aria-controls points at it. |
hidden | present or absent | Present until its radio is checked. |
data-state | "open" or "closed" | Whether its radio is checked. |
RadioGroup.Legend
Renders <legend>, the question and the group’s name. Put it first.
| Prop | Type | Default | Description |
|---|---|---|---|
marker | 'optional' | 'none' | 'optional' in a group that isn’t required, else 'none' | Whether the legend ends with the optional text, for example “(optional)”. |
| Class or attribute | Values | Meaning |
|---|---|---|
kv-fieldset-legend | always | The part class. |
data-invalid | present or absent | The group is invalid. |
data-required | present or absent | The group is required. |
data-disabled | present or absent | The group is disabled. |
RadioGroup.Prose
Renders <div> with the class kv-prose: the description, read before answering, above the options. It is listed in the group’s aria-describedby.
| Class or attribute | Values | Meaning |
|---|---|---|
kv-prose | always | The part class. The default theme styles it. |
data-invalid | present or absent | The group is invalid. |
data-disabled | present or absent | The group is disabled. |
RadioGroup.HelpText
Renders <p>: a short instruction under the options. It is listed in the group’s aria-describedby. A help text for one option is a Field.HelpText in that option’s RadioGroup.Option.
| Class or attribute | Values | Meaning |
|---|---|---|
kv-field-help-text | always | The part class. The default theme styles it. |
data-invalid | present or absent | The group is invalid. |
data-disabled | present or absent | The group is disabled. |
RadioGroup.ErrorMessage
Renders <p> that starts with the error icon and the hidden prefix. It renders only while the group is invalid, is the last item in the group’s aria-describedby, and is not a live region. Render one per group.
| Class or attribute | Values | Meaning |
|---|---|---|
kv-field-error-message | always | The part class. |
data-invalid | always | It renders only while the group is invalid. |
data-disabled | present or absent | The group is disabled. |
useRadioGroup
Options
| Prop | Type | Default | Description |
|---|---|---|---|
name | string | generated | The name every radio shares. |
value | string | null | – | Controlled: the value of the checked radio. null means nothing is checked. |
defaultValue | string | – | Uncontrolled: the value checked at the start. |
onValueChange | (value: string, details: { reason: "input"; event }) => void | – | Called with the value of the radio the user chose. It only reports. |
invalid | boolean | false | data-invalid on every radio, for styling. No aria-invalid. |
disabled | boolean | false | data-disabled on every radio. A <fieldset disabled> does the disabling. |
Result
| Prop | Type | Default | Description |
|---|---|---|---|
name | string | – | The shared name: the one given, else a generated one. |
getRadioProps | (value: string) => RadioGroupItemProps | – | The props for the radio with this value: name, checked or defaultChecked, onChange, aria-controls while a reveal is mounted, and the data attributes. |
getRevealProps | (value: string) => RadioGroupRevealItemProps | – | The props for the content that belongs to the radio with this value: id, hidden unless that radio is checked, and data-state. |
registerReveal | (value: string) => () => void | – | Call from an effect while a reveal for this value is mounted, so the radio gets aria-controls. Returns the cleanup. |
consumeUserChoice | (value: string) => boolean | – | True once when the user, not your value, just checked this radio: the moment to announce that a field appeared. |
resetSelection | () => void | – | Call when the surrounding form resets: an uncontrolled group goes back to its defaultValue. |
useRadio
A hook that gives your own <input type="radio"> the same attributes, wired to the nearest Option and RadioGroup. It returns inputProps to spread on the input, and isChecked (known from props only), isInvalid and isDisabled. It has no focus state: style focus with :focus-visible.
Options
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | – | What a form submit sends when checked, and the option’s value inside a RadioGroup. |
name | string | – | The name that groups the radios. Inside a RadioGroup, the group’s name is the default. |
disabled | boolean | false | Native disabled: skipped by Tab and by the arrow keys. |
checked | boolean | – | Controlled outside a RadioGroup. |
defaultChecked | boolean | – | Uncontrolled outside a RadioGroup. |
Strings
These are the default texts in @kvirn-ui/i18n.
For your whole app, pass messages to KvirnProvider. For one RadioGroup, pass its messages prop.
These are the Field strings, because the legend and the error use them.
field.optional
The legend’s marker when the group is not required.
| Language | Default text |
|---|---|
| Svenska | (valfritt) |
| Suomi | (vapaaehtoinen) |
| Norsk bokmål | (valgfritt) |
| Norsk nynorsk | (valfritt) |
| English | (optional) |
field.errorPrefix
Read before the error message, so it is not mistaken for help.
| Language | Default text |
|---|---|
| Svenska | Fel: |
| Suomi | Virhe: |
| Norsk bokmål | Feil: |
| Norsk nynorsk | Feil: |
| English | Error: |
These are the default texts in @kvirn-ui/i18n.
For your whole app, pass messages to KvirnProvider. For one RadioGroup.Reveal, pass its messages prop.
This string belongs to RadioGroup.Reveal, so a messages prop on the Root does not change it.
radioGroup.revealShown
Said politely once, when a user checks a radio whose Reveal opens. Not said when the page loads, when the form resets or when your code sets the value.
| Language | Default text |
|---|---|
| Svenska | Ett fält har visats nedanför. |
| Suomi | Alle on tullut näkyviin kenttä. |
| Norsk bokmål | Et felt har dukket opp nedenfor. |
| Norsk nynorsk | Eit felt har dukka opp nedanfor. |
| English | An input field has appeared below. |
Known issues#
- A required group isn't announced as required.
aria-requiredisn't supported ongrouporradio, and KvirnUI prefersaria-requiredover nativerequired. The group's legend loses its optional text and getsdata-required. If the AT run shows a gap:role="radiogroup"on the fieldset (allowed on<fieldset>, and it supportsaria-requiredandaria-invalid), or nativerequiredon the radios. - A radio has no focus state of its own.
useRadioreturns noisFocusVisibleandRadioGroup.Radiosets nodata-focus-visible: a radio's focus state would make the browser stop treating the group as one Tab stop. The theme styles focus with the native:focus-visible. aria-describedbyon a<fieldset>isn't announced consistently by TalkBack. See the Fieldset page.- Shift+Tab into an unchecked group. Browsers differ on which radio gets focus: Chrome and Firefox focus the last, Safari the first. The keyboard tests run on Chromium; the optional engines run in CI.
Information: Did you know?
Check these against your own service. Where one applies, name it in your accessibility statement with the workaround, so users know before they meet it.
Testing#
The automated tests prove the keyboard behaviour, the names and states, that axe finds no violations in every story and theme, and, for the components they cover, that the stories hold up in forced colours, reduced motion, text spacing and a 320 pixel width. An Automated row passes on these tests alone. A Core or Release row passes only when an automated agent check and a person on the real assistive technology have both checked it. "agent-verified" means automated tests in the repository (with a virtual screen reader for the screen reader rows), not the real assistive technology.
| AT + browser + OS | Agent check | Human check | Result | Notes |
|---|---|---|---|---|
| Automated (re-runnable tests) | ||||
| axe, WCAG 2.2 A and AA, every story, 4 themes | pass | n/a | pass | radio-group.stories.tsx, every story, 4 themes |
| Markup and ARIA (roles, names, ids, states) | pass | n/a | pass | radio-group.test.tsx › a Radio is a native <input type="radio"> with its class, no ARIA role; expectNoA11yViolations |
| Keyboard contract rows (Vitest browser) | pass | n/a | pass | 13 rows, each names a test (radio-group.test.tsx › Tab enters the group at the first radio when none is checked) |
| Focus order and management | pass | n/a | pass | radio-group.test.tsx asserts focus (toHaveFocus); first rule: Tab enters the group at the first radio when none is checked |
| Display modes (forced colours, 320px reflow, text spacing, reduced motion) | pass | n/a | pass | the four sweep projects (storybook-forced-colors, -reduced-motion, -reflow, -text-spacing), run in CI |
| Core (required for beta) | ||||
| NVDA + Chrome + Windows | pending | pending | pending | |
| VoiceOver + Safari + iOS | pending | pending | pending | |
| Release (before 1.0 and each minor) | ||||
| JAWS + Chrome + Windows | pending | pending | pending | |
| TalkBack + Chrome + Android | pending | pending | pending | |
| VoiceOver + Safari + macOS | pending | pending | pending |
What to check#
With a screen reader and the keyboard, try:
- Tab into the group: the legend and "group" are read.
- One Tab lands on the checked radio, or on the first if none is checked.
- The arrow keys move focus and check the radio, and wrap. A disabled option is skipped. In a right-to-left page the arrows are mirrored.
- Checking "Other" reads "An input field has appeared below." once, and Tab reaches the field.