Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

feat(Radio): add activation prop for focus vs click selection #94

@johnleider

Description

@johnleider

Summary

Add an activation prop to Radio.Root matching the pattern established in Tabs.Root.

Background

The Tabs component introduced an activation prop with two modes:

  • automatic (default): Selection occurs on focus (arrow key navigation)
  • manual: Selection occurs on explicit Enter/Space key press

WAI-ARIA Research

Standard Behavior

Per WAI-ARIA APG, radio groups should have selection follow focus by default:

"When arrow keys move focus to a radio button, it simultaneously unchecks the previously focused button and checks the newly focused button."

This is the standard behavior, not optional like tabs.

Exception: Toolbar Context

Radio groups inside toolbars should NOT auto-select:

"When navigating through a radio group in a toolbar with arrow keys, the button that is checked does not change."

Rationale for Adding Prop

While automatic activation is the ARIA standard, providing activation="manual" allows:

  • Toolbar radio group implementations
  • User preference for deliberate selection
  • Consistency with Tabs API

Proposed API

<Radio.Root v-model="selected" activation="manual">
  <Radio.Item value="a">Option A</Radio.Item>
  <Radio.Item value="b">Option B</Radio.Item>
</Radio.Root>

Implementation Notes

  • Add activation prop to RadioRoot.vue with type 'automatic' | 'manual'
  • Default to 'automatic' (standard ARIA behavior)
  • Modify RadioItem.vue onFocus handler to check activation mode
  • Add manual activation via Enter/Space in onKeydown

Industry Alignment

Library Prop Name Default
React Aria keyboardActivation 'automatic'
Radix UI activationMode 'automatic'
Vuetify v0 activation 'automatic'

Related

Checklist

  • Add activation prop to RadioRoot
  • Update RadioItem event handlers
  • Add tests for both activation modes
  • Update documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions