Skip to content

ToggleGroup orientation prop does not affect keyboard navigation #4487

Closed

Description

@peoray

Bug report

ToggleGroup accepts an orientation prop, but that prop is not forwarded to CompositeRoot. As a result, it affects the rendered state/data attributes, but not the composite keyboard navigation behavior.

Today, arrow key navigation still works on both axes because CompositeRoot falls back to its default orientation behavior.

Current behavior

ToggleGroup accepts an orientation prop (default 'horizontal'), but it is not forwarded to CompositeRoot. This means the prop only affects the rendered data-orientation attribute — it has no effect on keyboard navigation.

Since CompositeRoot defaults to orientation: 'both', arrow keys in all four directions always navigate between toggles, regardless of what orientation is set to.

// orientation="vertical" is set, but Left/Right arrows still navigate
<ToggleGroup orientation="vertical" defaultValue={['bold']}>
  <Toggle value="bold">B</Toggle>
  <Toggle value="italic">I</Toggle>
  <Toggle value="underline">U</Toggle>
</ToggleGroup>

Expected behavior

If orientation="vertical" is provided, I would expect navigation to be constrained to the vertical axis:

  • ArrowUp / ArrowDown move focus
  • ArrowLeft / ArrowRight should not be captured by the composite navigation

If orientation="horizontal" is provided, I would expect the inverse:

  • ArrowLeft / ArrowRight move focus
  • ArrowUp / ArrowDown are not handled by the group

Provide a clear and concise description of the expected behavior.

Reproducible example

Link to a CodeSandbox, StackBlitz, or other IDE.

Base UI version

For example v1.0.2

Which browser are you using?

Chrome/Safari/Firefox/Safari iOS etc.

Which OS are you using?

Mac OS/Windows/Other etc.

Which assistive tech are you using (if applicable)?

Voiceover/JAWS etc.

Additional context

Provide any additional context that might help us identify the problem and find a solution.

Activity

  1. changed the title [-]ToggleGroup orientation prop not forwarded to CompositeRoot[/-] [+]ToggleGroup orientation prop does not affect keyboard navigation[/+] on Mar 30, 2026
  2. added
    type: bugIt doesn't behave as expected.
    component: toggle groupChanges related to the toggle group component.
    and removed on Mar 30, 2026
  3. CiscoFran10 commented on Mar 30, 2026

    @CiscoFran10
    Contributor

    Not sure if this was intentional, but I think orientation should affect styling/layout only, not keyboard navigation.

    To me, multi-axis navigation here seems reasonable, so the main issue is user expectations, if current behavior is intentional, it should be documented more clearly i guess. Radio component seems to work multi-axis as well although there isnt a orientation prop there.

  4. CiscoFran10 commented on Mar 30, 2026

    @CiscoFran10
    Contributor

    Also, Toolbar already ties keyboard navigation to orientation, and I think that can create issues with embedded controls.

    For example, a vertical toolbar containing a Select may want ArrowDown to open the select, but that same key can also be interpreted as toolbar navigation, causing focus trap on the select trigger.

    So to me, this is another reason not to couple orientation too strictly to navigation.

  5. peoray commented on Mar 30, 2026

    @peoray
    Author

    That'd make sense. I just wanted to make sure it was a design decision and not a bug.

    Currently working on the toggle components for Base UI Vue

  6. mj12albert commented on Mar 30, 2026

    @mj12albert
    Member

    Keyboard navigation on both axes is fine situationally according to the spec which addresses this point:

    a vertical toolbar containing a Select may want ArrowDown to open the select, but that same key can also be interpreted as toolbar navigation

    But here it's a bug and not intentional; both Radix/RA support only one axis at a time and we intended to match that

  7. github-actions commented on Apr 1, 2026

    @github-actions

    This fix will be available in the next npm release of Base UI.

    In the meantime, you can try it out on our Canary release channel:

    npm i https://pkg.pr.new/@base-ui/react@4488
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: toggle groupChanges related to the toggle group component.type: bugIt doesn't behave as expected.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions