Skip to content

base: Add complete keyboard navigation to Tabs #2838

Description

@huacnlee

Problem

gpui_base::Tab currently supports pointer activation and accessibility roles, but it does not participate in keyboard focus. Tabs receives erased child elements, so it cannot currently coordinate focus between its tabs.

Before Tabs is treated as a complete desktop tab-list primitive, it needs compound keyboard behavior rather than making every tab an unrelated tab stop.

Required behavior

  • Roving focus: one tab stop for the active/selected tab.
  • Left/Right navigation for horizontal tab lists.
  • Up/Down navigation for vertical tab lists.
  • Home/End navigation.
  • Enter/Space activation.
  • Disabled tabs are skipped.
  • Focus remains stable across controlled selection updates and rerenders.
  • Accessibility selection, position and orientation remain correct.

Design constraint

The behavior belongs in gpui-base, not in gpui-shell. The current Tabs API stores AnyElement children, so the implementation needs an explicit typed item/registration contract or another Base-owned mechanism that lets the group coordinate child focus handles without moving selection state out of the application.

Verification

Add real GPUI keyboard tests covering forward/backward movement, wrapping policy, disabled tabs, Home/End, activation, focus retention, and horizontal/vertical orientation.

A TODO referencing this missing behavior is present beside gpui_base::Tab.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions