Repository navigation
fix(Slider): End reaches max even when the step grid skips it - #7484
Conversation
…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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewModified ComponentsSlider (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Visual Regression44 of 448 shot(s) changed. A change here is a question, not a failure: check whether the after is the
and 24 more. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
There was a problem hiding this comment.
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} |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
…n 1; arrows and PageUp still snap and clamp from an off-grid max)
|
/approve-spec 6ca4bc6 |
Title, Changeset and test title no longer claim Home: the step grid is anchored at min, so Home always reached it.
|
/approve-spec 7bd5687 |
|
/approve-spec 524bde2 |
There was a problem hiding this comment.
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]
|
/approve-spec 417bc2f |
There was a problem hiding this comment.
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]
Problem
A keyboard user pressing End on a Slider whose
maxis not on the step grid (for examplemax={100}withstep={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:SliderAR1 (#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 atmin, so Home always reached it;maxmay lie off the grid. Arrow and Page key results keep ORD1's snap-then-clamp (snapToStepL396–401 unchanged). Source:handleKeyDownL855–861,updateValueL670–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 withSlider.tsxreverted to main; Slider suites 83/83 with the fix.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).Record
Per the fix-PR rule, this PR deletes the End gap sentence from
component:SliderAR1 (the record landed in #7463).Changeset
@astryxdesign/corepatch[fix]. Merges after #7463.Writing rubric results
R1 narration: none; AR1 states End reaching
maxin 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.tsxEnd 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
mainsince 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.