Skip to content

Table: support configuring initial Tab focus target (e.g. first column header) #10121

@coolassassin

Description

@coolassassin

Provide a general summary of the feature here

With roving tabIndex, first Tab into <Table> uses useSelectableCollection + GridKeyboardDelegate.getFirstKey(), which targets the first body row/cell. Apps that need first Tab on columnheader (sortable headers, WCAG patterns) must manually fight focusedKey, grid tabIndex={0}, and per-cell tabIndex overrides.

🤔 Expected Behavior?

Prop such as initialFocusTarget="firstColumnHeader" (or autoFocus="firstHeader") that sets initial focusedKey to the first column and moves DOM focus accordingly.

😯 Current Behavior

On the first Tab into a RAC <Table>:

While focusedKey is null, the [role="grid"] gets tabIndex={0}.
onFocus calls getFirstKey(), which picks the first body row (and with focusMode: 'cell' — the first body cell). Column headers are not used as the initial target.
Items get tabIndex={0} only when their key matches focusedKey; everything else is -1.
There is no prop to start Tab on the first columnheader, and

does not expose keyboardDelegate to override this.

Result: first Tab lands on the grid or a body cell, not the header. Apps that need header-first Tab must patch tabIndex and focus manually.

💁 Possible Solution

useSelectableCollection (onFocus ~366, tabIndex ~594), GridKeyboardDelegate.getFirstKey, TableKeyboardDelegate (columns are isCell but excluded from getFirstKey).

🔦 Context

Table with header + body, Tab from outside → focus lands on first body cell, not first columnheader.

Workaround for today:
Custom marshal + tabIndex overrides in app code (react-aria-components Table consumers).

💻 Examples

No response

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions