Skip to content

fix(core): RTL arrow-key nav for TreeList + auto-detect direction across focus hooks - #4682

Merged
nynexman4464 merged 1 commit into
mainfrom
nynexman4464/fix/tree-focus-rtl
Aug 4, 2026
Merged

fix(core): RTL arrow-key nav for TreeList + auto-detect direction across focus hooks#4682
nynexman4464 merged 1 commit into
mainfrom
nynexman4464/fix/tree-focus-rtl

Conversation

@nynexman4464

@nynexman4464 nynexman4464 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

What

Two related RTL keyboard-navigation improvements to the focus hooks:

  1. TreeList now navigates correctly in RTL. useTreeFocus mirrors ArrowLeft/ArrowRight under dir="rtl" — ArrowLeft expands / enters children, ArrowRight collapses / moves to parent (per the WAI-ARIA Tree View pattern). Direction is auto-detected from the tree container; LTR is unchanged.

  2. Deprecate the isRtl override on useListFocus / useGridFocus. All three focus hooks now auto-detect direction from the container's computed direction, so an explicit isRtl boolean is redundant — there's no valid reason to force RTL arrows in an LTR context. isRtl is marked @deprecated and slated for removal in an upcoming major (mirrors the Dialog position deprecation approach). useTreeFocus ships auto-detect only (no isRtl — it's new API).

AvatarGroup (the only component that passed isRtl explicitly) is migrated to rely on auto-detect; it previously reimplemented the same getComputedStyle(...).direction read the hook now does internally.

Why

The physical→logical CSS migration and the visual pr-rtl audit cover geometry, not keyboard semantics. useTreeFocus was the one directional-keyboard hook that hadn't been made RTL-aware, so RTL users got inverted expand/collapse. Consolidating on auto-detect (and retiring the override) keeps the public API minimal and direction handling consistent across the focus hooks.

Testing

101 tests pass across useTreeFocus / useListFocus / useGridFocus / AvatarGroup / doc-props. New RTL tests cover tree expand-on-ArrowLeft, collapse-on-ArrowRight, and vertical-keys-unaffected. Lint clean at error. LTR behavior unchanged.
@nynexman4464

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 3, 2026
@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview Aug 3, 2026 4:09pm

Request Review

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

AvatarGroup (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 261 -
Complexity N/A Medium (15) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.9KB 1.3KB

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@nynexman4464
nynexman4464 force-pushed the nynexman4464/fix/tree-focus-rtl branch from fc2435a to 89e5dc8 Compare August 3, 2026 16:06
@nynexman4464 nynexman4464 changed the title fix(core): mirror TreeList keyboard nav (ArrowLeft/Right) under RTL fix(core): RTL arrow-key nav for TreeList + auto-detect direction across focus hooks Aug 3, 2026
github-actions Bot added a commit that referenced this pull request Aug 3, 2026
github-actions Bot added a commit that referenced this pull request Aug 3, 2026
@nynexman4464
nynexman4464 marked this pull request as ready for review August 3, 2026 23:18
@nynexman4464
nynexman4464 merged commit 99a25c8 into main Aug 4, 2026
20 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant