Skip to content

fix(Slider): End reaches max even when the step grid skips it - #7484

Merged
cixzhang merged 8 commits into
mainfrom
fix/slider-end-max
Oct 13, 2026
Merged

cixzhang merged 8 commits into
mainfrom
fix/slider-end-max

Conversation

@cixzhang

@cixzhang cixzhang commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Problem

A keyboard user pressing End on a Slider whose max is not on the step grid (for example max={100} with step={3}) stopped one step short at 99, while ArrowRight and PageUp could still reach 100. APG Slider: End "sets the slider to the last allowed value in its range"; component:Slider AR1 (#7463) adopts it and names this gap.

Fix

Home and End pass the bound itself to updateValue (snap: false), which still clamps. Only End changes behaviour: the step grid is anchored at min, so Home always reached it; max may lie off the grid. Arrow and Page key results keep ORD1's snap-then-clamp (snapToStep L396–401 unchanged). Source: handleKeyDown L855–861, updateValue L670–681.

Evidence

  • Slider.test.tsx: "End reaches an off-grid max from a non-zero min, and Home still reaches min" (min 1, max 101, step 3 → End 101, Home 1) and "End lands on max when max is off the step grid, while arrows still snap" (0–100, step 3 → End 100; then ArrowLeft 100 → 96 and PageUp clamps to 100). Red arm: both tests fail with Slider.tsx reverted to main; Slider suites 83/83 with the fix.
  • The Slider contract binding (test(a11y): Slider contract and binding #7483) records this as the exact known failure slider.keys.home-end / step-three; once this lands after test(a11y): Slider contract and binding #7483, that record is removed in its own follow-up (or here, if this merges second — the ledger edit will be added then).
  • tsc, eslint, Prettier clean.

Record

Per the fix-PR rule, this PR deletes the End gap sentence from component:Slider AR1 (the record landed in #7463).

Changeset

@astryxdesign/core patch [fix]. Merges after #7463.

Writing rubric results

R1 narration: none; AR1 states End reaching max in the present tense (the gap sentence this fix closes is deleted, not narrated).
R2 research: none in the record.
R3 evidence: the AR1 verification cell cites suites and titles, not changes; the End outcome is covered by the new Slider.test.tsx End tests.
R4 rejected alternatives: none added.
R5 change references: one pre-existing, outside this PR's edit — FR2's basis cell reads "Current source, public docs, and #6224" (on main since the record was approved). Not touched here to keep this fix atomic; flagged for the record owner's next pass.
R6 open questions: unchanged — OQ1 (family target coverage) is unanswered and keeps its question.

…grid skips them

component:Slider AR1 (APG Slider: End sets the last allowed value). Home and
End now pass the bound itself instead of snapping it to the step grid; arrows
and Page keys keep ORD1's snap-then-clamp. Red-armed.
@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 10:43pm 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, 11:19 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 953 -
Complexity N/A Very High (148) -

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 fix looks correct: End now lands on max when max is off the step grid (the new off-grid test fails without the change and passes with it), arrow and Page keys still snap, and no public API changes. Approval is waiting on spec authority, not code: the rule this implements, component:Slider AR1 (“Home moves to min and End to max”), is still only proposed in #7463, so a maintainer needs to land that record on main, or point to a claim already on main that settles End reaching an off-grid max. Optionally, tighten the tests: the min={1} case is on the grid and passes without the fix, and the ArrowRight check starts on the grid, so neither guards what its name says.

[Automated review]

<Slider
label="Zoom"
min={1}
max={100}

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.

Optional: with min={1}, max={100} is on the step grid (1 + 33 × 3), so this test passes without the fix. Setting max={101} and expecting End to emit 101 (it emitted 100 before the fix) would make it a second failing-before case from a non-zero min, as the comment below suggests.

// ORD1 for arrows and Page keys is unchanged: 48 + 3 snaps to 51.
onChange.mockClear();
await user.keyboard('{ArrowRight}');
expect(onChange).toHaveBeenLastCalledWith(51);

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.

Optional: 48 is on the grid, so 48 + 3 = 51 passes even if no key snaps. Starting off the grid (for example value={50}, where ArrowRight gives 54) would guard snap-then-clamp, and asserting that onChangeEnd receives 100 after End would cover the payload handleKeyDown computes separately from updateValue.

@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 6ca4bc6

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Oct 13, 2026
Title, Changeset and test title no longer claim Home: the step grid is
anchored at min, so Home always reached it.
@cixzhang cixzhang changed the title fix(Slider): End reaches max and Home reaches min even when the step grid skips them fix(Slider): End reaches max even when the step grid skips it Oct 13, 2026
@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 7bd5687

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

Copy link
Copy Markdown
Contributor Author

/approve-spec 524bde2

@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.

The fix itself is correct and well tested: End now lands on max when max is off the step grid, as the Slider record's keyboard rule requires, and the new tests fail without the change and pass with it. One thing is needed before approval: because this pull request also edits Slider.spec.md, please add a ## Writing rubric results section to the description with one line per rubric item from docs/contributing/spec-writing.md. Whichever of this pull request and #7483 merges second will also need to remove the slider.keys.home-end / step-three known failure.

[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 417bc2f

@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 is ready to approve: End now lands on max when max is off the step grid, as the Slider record's keyboard rule requires, while arrow and Page keys still snap to the step grid and clamp. The new tests fail without the fix and pass with it, and the Slider accessibility contract passes in Chromium with the stale step-three known failure removed. The writing-rubric results and the known-failure cleanup requested earlier are both in place. Optionally, refresh the description: its line references and test count are out of date, and it still describes the known-failure removal as a later step.

[Automated review]

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

This branch was successfully deployed

1 active deployment
Preview — 417bc2f4 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