Repository navigation
[Component Audit] Slider: docs say when onChange and onChangeEnd fire and that a disabled thumb stays focusable #14207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
cixzhang
wants to merge
6
commits into
main
Choose a base branch
from
night-watch-component-audit/Slider/2026-12-02
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+944
−16
Draft
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4631ddf
fix(Slider): a keyboard step's onChangeEnd reports the value the owne…
cixzhang abc7b1f
docs(Slider): keep the keyboard onChangeEnd payload for a declared mi…
cixzhang 32e43aa
docs(Slider): the callback docs name the track tap, the mouse press a…
cixzhang f654a7b
docs(Slider): only a finger's or a pen's press that the browser cance…
cixzhang 9668d8f
docs(Slider): onChangeEnd names the touches that set no value and a p…
cixzhang e18e459
docs(Slider): the dense onChangeEnd line bounds the touches that repo…
cixzhang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [docs] Slider: the `onChange` and `onChangeEnd` docs say when each callback fires, for a drag, a mouse press or a finger's tap on the track, a cancelled press and a keyboard step; the `disabledMessage` docs say a disabled thumb stays focusable with or without a reason; the Chinese docs list `width` and translate `disabledMessage`, and the dense docs describe both. | ||
|
|
||
| @cixzhang |
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,9 +99,9 @@ export interface SliderBaseProps extends Omit< | |
| /** | ||
| * Explains why the slider is disabled. When set together with `isDisabled`, | ||
| * the slider shows a tooltip with this text on hover and keyboard focus, and | ||
| * the thumb stays focusable (via `aria-disabled`) so the reason is | ||
| * discoverable by keyboard and assistive technology. Value changes stay | ||
| * blocked. | ||
| * the thumb is described by it, so the reason is discoverable by keyboard | ||
| * and assistive technology. A disabled thumb stays focusable with | ||
| * `aria-disabled` either way. Value changes stay blocked. | ||
| * | ||
| * Use this instead of wrapping a disabled slider in `Tooltip` — disabled | ||
| * controls don't emit the pointer events an external tooltip needs. | ||
|
|
@@ -158,18 +158,42 @@ export interface SliderBaseProps extends Omit< | |
| export interface SliderSingleProps extends SliderBaseProps { | ||
| /** Current value (single thumb mode). */ | ||
| value: number; | ||
| /** Callback fired on value change during drag. */ | ||
| /** | ||
| * Callback fired on each value step: through a pointer drag and a finger's | ||
| * coast, at once on a mouse press on the track, from the lift of a finger's | ||
| * or a pen's tap on the track, and on each keyboard step. | ||
| */ | ||
| onChange?: (value: number) => void; | ||
| /** Callback fired when drag ends (on pointer up or keyboard). */ | ||
| /** | ||
| * Callback fired once when an interaction ends: a pointer release or a | ||
| * cancelled drag (after a finger's coast or a track tap's spring settles, | ||
| * or at a press that stops it), or a completed keyboard step. A finger's or | ||
| * a pen's touch on the track that sets no value (a tap on the thumb's own | ||
| * value or during a coast, or a swipe) reports nothing, and so do a | ||
| * finger's or a pen's press that the browser cancels before it moves and a | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Miss: same bound as the docs entry — a mouse press on a thumb that the browser cancels before the value moves reports nothing too, so the pointer type is not what separates the cases. Please bound it by the thumb here and at line 194: * value or during a coast, or a swipe) reports nothing, and so do a press
* on a thumb that the browser cancels before the value moves, a finger's
* or a pen's press on the track that it cancels, and a drag that disabling
* the slider cancels before the value moves. |
||
| * drag that disabling the slider cancels before the value moves. | ||
| */ | ||
| onChangeEnd?: (value: number) => void; | ||
| } | ||
|
|
||
| export interface SliderRangeProps extends SliderBaseProps { | ||
| /** Current value (range mode: [min, max]). */ | ||
| value: [number, number]; | ||
| /** Callback fired on value change during drag. */ | ||
| /** | ||
| * Callback fired on each value step: through a pointer drag and a finger's | ||
| * coast, at once on a mouse press on the track, from the lift of a finger's | ||
| * or a pen's tap on the track, and on each keyboard step. | ||
| */ | ||
| onChange?: (value: [number, number]) => void; | ||
| /** Callback fired when drag ends (on pointer up or keyboard). */ | ||
| /** | ||
| * Callback fired once when an interaction ends: a pointer release or a | ||
| * cancelled drag (after a finger's coast or a track tap's spring settles, | ||
| * or at a press that stops it), or a completed keyboard step. A finger's or | ||
| * a pen's touch on the track that sets no value (a tap on the thumb's own | ||
| * value or during a coast, or a swipe) reports nothing, and so do a | ||
| * finger's or a pen's press that the browser cancels before it moves and a | ||
| * drag that disabling the slider cancels before the value moves. | ||
| */ | ||
| onChangeEnd?: (value: [number, number]) => void; | ||
| /** Minimum number of steps between thumbs. */ | ||
| minStepsBetweenThumbs?: number; | ||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Miss: this bound is by pointer type, but the case is the thumb. A mouse press on a thumb that a window blur or a
pointercancelends before the value moves reports nothing either, while the same press released normally reports once (run against this head: no call with the cancel,onChangeEnd(50)without it, both under a fine and a coarse primary pointer; after the value has moved the cancel reportsonChangeEnd(60)). A thumb press belongs to the touch controller for every pointer (Slider.tsx:1138-1148), and a cancel there ends it with no report; a mouse press on the track keeps reporting, since it sets the value at once. For example:'Callback fired once when an interaction ends: a pointer release or a cancelled drag (after a finger’s coast or a track tap’s spring settles, or at a press that stops it), or a completed keyboard step. A finger’s or a pen’s touch on the track that sets no value (a tap on the thumb’s own value or during a coast, or a swipe) reports nothing, and so do a press on a thumb that the browser cancels before the value moves, a finger’s or a pen’s press on the track that it cancels, and a drag that disabling the slider cancels before the value moves.'The same bound is in the Chinese entry (line 361), the dense line (line 603) and both
onChangeEndJSDoc blocks inSlider.tsx.