Repository navigation
Conversation
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.
Depends on #8118 (which carries #8360) and #8123, merged in. Review only this PR's change: vjeux/astryx@c02-8124-base...uikit/c02-switch-touch
This push re-applies this PR's Switch rows on main's current Switch record (FR10, FR13–FR15), so it needs a fresh spec approval; it also merges #8118's fold onto #8360. This PR's code is unchanged apart from comments citing the new FR numbers.
Why
On a phone, Switch acts like a desktop checkbox: a finger can't drag its thumb (P3), and it freezes while the page runs scripts (P10).
What led to it
spec:AST-094(current) asks every control to feel native under a finger: follow it, keep moving while scripts run, and never take the page's scroll. Switch had only the browser checkbox. #8123 measured iOS's own switch for this one to match;component:SwitchFR10 and FR13–FR15 change here.Options and tradeoffs
translate,scale,opacityonly): follows the finger, keeps moving through a blocked main thread, and a vertical swipe still scrolls. It costs the shared touch layer (34.2 KB gzip), which every touch component reuses.Two behaviours picked a side:
spec:AST-020FR9 allows (P19).spec:AST-094FR11, FR20).Why this choice
Only option 3 meets AST-094's motion and scroll rules; its cost is shared, and the mouse, keyboard and screen-reader paths are unchanged. No API change: the thumb keeps its circle and size, and under a coarse pointer its hit area grows toward 44 px, stopping halfway to a neighbour (P17).
How to check it
Open Storybook's Switch › Default on a phone or the iOS simulator:
Switch.interaction.browser.spec.tsruns these with real touch input in Chromium and WebKit. The one red check, "is absent from the root entry", is the old bundle test that #8671 replaces.Evidence
iOS 26.2 simulator and Android 15 emulator: main, this PR, then iOS's own switch where shown; the red ring is the finger. P4 runs in Chromium; P11 uses a mouse. A3 and A8 show this PR only: main's takes drop frames.
Scope
Writing rubric results
packages/core/src/Switch/Switch.spec.md:spec:AST-094FR11 andspec:AST-020FR9.