Skip to content

fix(Slider): horizontal arrow keys follow the mirrored track under RTL - #7461

Merged
cixzhang merged 3 commits into
mainfrom
fix/slider-rtl-keys
Oct 13, 2026
Merged

cixzhang merged 3 commits into
mainfrom
fix/slider-rtl-keys

Conversation

@cixzhang

Copy link
Copy Markdown
Contributor

Problem

A keyboard user on a right-to-left page moves a horizontal Slider's thumb with the arrow keys and it goes the wrong way: ArrowRight increased the value, but under RTL the track is mirrored and the value grows toward the LEFT, so the thumb visibly moved against the key. The APG Slider pattern ties the horizontal arrows to the track's direction; the pointer path already mirrors (a track click maps to the RTL value), the keyboard did not.

Fix

In the thumb keydown handler, on a horizontal track whose computed direction is RTL (the existing isRtlElement(track) helper, the same one the pointer mapping uses), ArrowLeft steps toward max and ArrowRight toward min. ArrowUp/ArrowDown, PageUp/PageDown, Home/End, and vertical sliders are unchanged.

Evidence

  • Slider.test.tsx: new "follows the mirrored track under RTL" — ArrowLeft 50→51, ArrowRight →49, ArrowUp →51, ArrowDown →49 with the track's computed direction forced to rtl; and "keeps ArrowLeft decreasing on a vertical track under RTL". Red arm: with Slider.tsx reverted to main the first test fails (ArrowLeft produced 49), 74/75; with the fix 75/75 (83/83 across the Slider folder).
  • tsc and eslint clean.

Changeset

@astryxdesign/core patch [fix].

Record

component:Slider's adoption of the APG Slider pattern (which names this behaviour) is in a separate record pull request; this is the behaviour fix it depends on.

Under RTL the value grows toward the left, so ArrowLeft now increases and
ArrowRight decreases on a horizontal track (APG Slider); ArrowUp/ArrowDown,
PageUp/PageDown, Home/End and vertical tracks are unchanged. Uses the
existing direction helper on the track; red-armed test.
@vercel

vercel Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 13, 2026 8:23pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 13, 2026
@astracat-bot

astracat-bot Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 13, 2026, 8:50 PM UTC

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

Modified Components

Slider (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 944 -
Complexity N/A Very High (145) -

Bundle Size Summary

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

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

44 of 448 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Selector Indicator Space Bottom Sheet Narrow End RTL neutral light 754,077
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,188
Chat Full AI Chat probe light 238,081
Chat Full AI Chat probe dark 237,048
Markdown Default probe light 159,625
Markdown Default probe dark 158,986
Collapsible Dividers probe dark 66,445
Collapsible Dividers probe light 66,445
Chat Default neutral dark 33,205
Chat Default neutral light 32,876
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,406
Chat With Attachments probe dark 11,232
ProgressBar With Target Mark probe dark 7,895
ProgressBar With Target Mark probe light 7,895
TableRowExpansion Detail Panel neutral dark 5,150
TableRowExpansion Detail Panel neutral light 4,068

and 24 more.


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

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation looks sound — the new RTL keyboard test fails against the existing Slider and passes with the fix, and vertical sliders plus the Up/Down, Page and Home/End keys are unchanged — but approval waits on a maintainer to provide or identify the governing spec for this behavior. On main, the component:Slider contract records no keyboard behavior and spec:AST-020 makes an APG pattern binding only once a component contract adopts it, so nothing yet settles which horizontal arrow raises the value under RTL. What must be settled is a current record for Slider's RTL arrow mapping (for example, landing the adoption proposed in #7463), which also decides whether this ships as a patch [fix] under spec:AST-017. No code changes are requested in the meantime.

[Automated review]

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Oct 13, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 57be5b1

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Oct 13, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is ready for maintainer approval: the Slider record on main now specifies that a horizontal slider's arrow keys follow the track under right-to-left layouts, and this pull request implements exactly that as a patch fix. The new RTL keyboard test fails against the previous behavior and passes with the fix, and a real-browser check confirms that ArrowLeft now moves the thumb left on an RTL page while left-to-right and vertical sliders behave as before. Nothing further is needed from you.

[Automated review]

@cixzhang
cixzhang merged commit 5f41747 into main Oct 13, 2026
56 checks passed
@github-actions
github-actions Bot deleted the fix/slider-rtl-keys branch October 14, 2026 06:22

This branch was successfully deployed

1 active deployment
Preview — 57be5b1b Deployed Oct 13, 2026 by vercel[bot]
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