fix(core): RTL arrow-key nav for TreeList + auto-detect direction across focus hooks - #4682
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
nynexman4464
force-pushed
the
nynexman4464/fix/tree-focus-rtl
branch
from
August 3, 2026 15:45
241a657 to
fc2435a
Compare
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsAvatarGroup (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
…precate isRtl override on focus hooks
nynexman4464
force-pushed
the
nynexman4464/fix/tree-focus-rtl
branch
from
August 3, 2026 16:06
fc2435a to
89e5dc8
Compare
nynexman4464
marked this pull request as ready for review
August 3, 2026 23:18
nynexman4464
requested review from
cixzhang,
ejhammond and
imdreamrunner
as code owners
August 3, 2026 23:18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two related RTL keyboard-navigation improvements to the focus hooks:
TreeList now navigates correctly in RTL.
useTreeFocusmirrors ArrowLeft/ArrowRight underdir="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.Deprecate the
isRtloverride onuseListFocus/useGridFocus. All three focus hooks now auto-detect direction from the container's computeddirection, so an explicitisRtlboolean is redundant — there's no valid reason to force RTL arrows in an LTR context.isRtlis marked@deprecatedand slated for removal in an upcoming major (mirrors the Dialogpositiondeprecation approach).useTreeFocusships auto-detect only (noisRtl— it's new API).AvatarGroup(the only component that passedisRtlexplicitly) is migrated to rely on auto-detect; it previously reimplemented the samegetComputedStyle(...).directionread the hook now does internally.Why
The physical→logical CSS migration and the visual
pr-rtlaudit cover geometry, not keyboard semantics.useTreeFocuswas 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