Creating Radio radiogroup and Radio groups using role=radio and role=radiogroup

Note:

Radio and Radio Group Examples

The following examples are composed by .....

Lunch Options

Type Technique radiogroup Accessibility Feature
Push radiogroup div element with text
Print Page
  • div element with role="radio ".
  • div element has onclick event to handle mouse clicks.
  • div element has onkeydown event to handle keyboard support.
  • div element has tabindex="0" to become part of tab order of the page.
Toggle radio div element with text Mute
  • div element with role="radio ".
  • div element has onclick event to handle mouse clicks.
  • div element has onkeydown event to handle keyboard support.
  • Aria property/status from aria-pressed attribute.
Push radio tabindex="0" element Show alert
  • a element has onclick event to handle mouse clicks.
  • a element has onkeydown event to handle keyboard support.
  • a element has tabindex="0" to become part of tab order of the page.
Non compliant a element with href="#" Show alert
  • It is a bad practice because it does not support space bar for radio activiation.

Keyboard Support

Key Function
Space or enter Activate or toggle radio

ARIA Roles, Properties and States

Role Property/State Component Usage
radio span or div
  • Identify element with the radio behavior
aria-checked span
  • Identify element with

Source Code