Repository navigation
feat(SegmentedControl): under a finger, the selected surface lifts - #9724
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| SegmentedControl | 99.9 kB (+391 B) · 6.9 kB CSS (0) | — | ✗ · ✓ · ✓ |
| SegmentedControlItem | 18.5 kB (0) · 4.3 kB CSS (0) | — | ✗ · ✓ · ✓ |
| DateTimeInput | 215.0 kB (+445 B) · 18.8 kB CSS (0) | — | — · — · — |
Visual changes: 1 snapshot in 1 component
A change is a question for the reviewer, not a failure.
| Component · story | Before | After | Diff |
|---|---|---|---|
| SegmentedControl · Default (neutral, dark) | ![]() |
![]() |
![]() |
Package size: measured; main has no measurement of the merge base to compare yet.
API changes: unknown (base surface unavailable): richtext, theme-butter, theme-chocolate, theme-gothic, theme-matcha, theme-neutral, theme-stone, theme-y2k
Touched components checked; add ci:run-visual, ci:run-a11y or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
|
/approve-spec 96b5d65 |
There was a problem hiding this comment.
Changes requested: the lift behaves as the approved FR14 describes, but two things need fixing first.
- In the default light and dark themes the lifted selected surface is the page's own colour with no edge, so holding a segment erases the track around it (an end segment loses the track's end, a middle segment splits it in two); give the lifted surface a visible edge, such as the theme's elevation shadow Switch puts on its lifted thumb, and add a browser assertion that the track stays visible around a held segment.
- The usage description in
SegmentedControl.doc.mjsnow says both that pressing the selected segment lifts it and that "nothing lifts or dims"; end it with "a pressed unselected segment shows the shared pressed overlay, and nothing dims" instead.
The spec changes are approved for this revision and the unit suites pass. The rest is optional: a stale line in motion/MEASUREMENTS.md, two comment wordings, and the FR14 row of the verification map, which fills only two of its five columns.
[Automated review]
96b5d65 to
91c7ee4
Compare
|
/approve-spec 91c7ee4 |
There was a problem hiding this comment.
Changes requested: the lift and its new edge behave as the approved FR14 describes while a segment is held, but two things need fixing first.
design:user-statesDR3 (its rule, anatomy and matrix rows, and example) andcomponent:SegmentedControlItemFR5 still say the selected segment keeps its raised surface unchanged during a hold under every pointer, so amend them in this PR to allow the touch lift (or drop the lift), and update the "selected-segment exception" line in the SegmentedControl record.- After a drag that commits another segment,
select()repaints the lens from the destination (useSegmentedSelectionMotion.ts:633) and drops the lifted shadow while the surface is still grown, so for about 0.1 s the white surface again covers the track's edges; keep the lifted shadow until the hand-back and assert it after a committing drag.
The spec changes are approved for this revision, the consumer description now reads consistently, and the unit and Chromium lift tests pass. One optional cleanup: the browser spec comment at SegmentedControl.interaction.browser.spec.ts:450-451 still gives the old "a pressed thumb's lift is a theme's" reason.
[Automated review]
91c7ee4 to
c2bc372
Compare
ba3e59d to
76c0718
Compare
|
/approve-spec 76c0718 |
There was a problem hiding this comment.
Changes requested: the lift and its edge behave as the owner-approved FR14 describes, but one current record still contradicts them.
design:user-statesDR3 (its rule, anatomy row, matrix row and example) still says the selected SegmentedControl item keeps its surface unchanged during a hold under every pointer, and FR14's "one exception" sentence cannot override another current record (architecture:knowledge-contractsINV9 and DEC-1), so restore the DR3 amendment from the previous push, have DR3 link to FR14 instead, or drop the lift.
The edge now survives a committing drag, which settles the earlier finding. One optional comment-style suggestion is inline.
[Automated review]
|
/revoke-spec 76c0718 |
Under a finger, a press on the selected segment grows its surface by 24 × 16 pt on UIKit's measured lift spring (critically damped, 0.25 s), and it settles back on that spring at the release. While lifted it carries the theme's low elevation shadow, as Switch's lifted thumb does, until the surface is handed back, so the track stays visible around it. The lift follows the presentation: a finger or a pen on a touch device lifts it, while a desktop mouse and Reduce Motion lift nothing. The record gains FR14 and the `segmented.lift` motion role. FR14 names the lift as the one exception to design:user-states DR3's unchanged surface, which this change leaves as it is. UIKit projects no flick, so the release position still decides the segment.
76c0718 to
25e8e4c
Compare
There was a problem hiding this comment.
Changes requested: the touch lift behaves as the owner-approved component:SegmentedControl FR14 describes, but one case leaves the selected surface in the wrong place.
- Miss: tapping a segment and pressing it again while its slide is still running pins the lifted surface where the slide had got to, over the previous segments, until the finger lets go, against FR9's slide to the new segment; in
lift()(useSegmentedSelectionMotion.ts:698-710)hold()ends the running slide and only the scale springs, so also springxto 0 on the selection spring with the captured velocity, and add a test that holds the selected segment mid-slide.
The record changes carry an engineering owner's approval for this revision, no public API changes, and the SegmentedControl unit tests and the 59 Chromium interaction cases pass. CI has not run on this head yet because the pull request is a draft.
A finger that presses the segment a tap just chose, while the lens still slides there, lifted the lens where the slide had got to. The hold stops the running slide, and the lift sprang only the scale. The lift now also springs the lens's offset to its segment on the slide spring, with the slide's own velocity.
|
/approve-spec f6995a5 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this revision yet, because the pull request is a draft. It runs once the pull request is marked ready for review.
The touch lift matches the owner-approved component:SegmentedControl FR14 and the amended design:user-states DR3. The last review's blocker is fixed: a press on the segment a tap has just chosen now lets the surface finish its slide and lift there, and the new unit case covers it. Two optional comment rewrites remain in useSegmentedSelectionMotion.ts (the lift() JSDoc and the showLiftedEdge() doc).
| * The lens binds on the selected segment and grows by `liftGrowth` on the | ||
| * `lift` spring. A slide still on its way goes on to that segment on the |
There was a problem hiding this comment.
Optional (comment style, INV29): the first sentence narrates the body below. Suggested: "A running slide keeps its speed to this segment. Under the touch presentation any pointer lifts the lens, as Switch's thumb does. A fine primary pointer and Reduce Motion keep it at its resting size."
|
/approve-spec 12b9d7f |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this revision yet, because the pull request is a draft. It runs once the pull request is marked ready for review.
The touch lift matches the owner-approved component:SegmentedControl FR14 and the amended design:user-states DR3, and the merge of main leaves the pull request's own changes as they were. Two optional comment rewrites remain in useSegmentedSelectionMotion.ts (the lift() JSDoc and the showLiftedEdge() doc).
|
/approve-spec 12b9d7f |
|
Decision: D-20261111-287 |
|
/approve-spec 9c73784 |
|
Decision: D-20261111-324 |
There was a problem hiding this comment.
Approved. The touch lift matches the owner-approved component:SegmentedControl FR14 and the amended design:user-states DR3: a finger's or a pen's press on the selected segment grows it by 24 × 16 px with the theme's low shadow and settles back at the release, while a mouse, a trackpad or Reduce Motion lifts nothing. CI passes on this revision.
Optional:
design:user-statesDEC-1 still says the selected segment's raised surface stays "stable"; a sentence after its unchanged Decider line pointing to the touch lift would keep the decision in step with DR3.



User need
On iOS 26, pressing a segmented control's selected segment lifts its surface, as Astryx's Switch thumb does. Our SegmentedControl stays flat. Specs decision, Nov 2 2026: the selected surface lifts for consistency with Switch's thumb lift.
Problem and solution fit
Current specification
Rebased onto main b6b0c68. Main's FR9 and FR10, a slide under every pointer, stand.
component:SegmentedControlFR14 (new) and FR11's last sentence.design:user-statesDR3 now states the lift, in its rule, anatomy, matrix and example, and FR14 points to it.component:SegmentedControlItemFR5 defers to it.spec:AST-094FR4 gainssegmented.lift, andmotion-roles.mdis regenerated.component:SwitchFR13 is the lift this matches./approve-spec <head sha>): AST-094, its motion-roles table, both SegmentedControl records anddesign:user-states.Measurements (iOS 26.2 simulator, iPhone 17 Pro)
UIViewSpringAnimationBehaviorSettings(1.0, 0.25) on the lens. A per-frame fit leaves 0.16 pt rms on the lift and 0.05 pt on the settle.Public delta and caller burden
No API, prop or theme change. The lifted surface paints up to 6 px above and below the track and 10 px past its ends, as UIKit's does.
Design and alternatives
Chosen: a built-in measured motion role,
segmented.lift, as for Switch's thumb lift.#8596's general lift role closed without merging. Not in scope: UIKit's cancel rules and its stretch along a slide.Scope
Writing rubric results
FR14, FR11, SegmentedControlItem FR5 and
design:user-statesDR3: R1–R6 none. FR14's first sentence is the spec owners' wording. Its last sentence now points to DR3.Testing
In "Default", press and hold the selected segment by touch: its surface grows with a soft shadow, and it settles back when you let go. With a mouse, nothing lifts.
derivedVarRegistry.test.ts) at 4bd76ea--shadow-lowtoken directly, and the radiogroup declares nothing newpnpm lint:strict(CI's mode), core typecheck,check:knowledge, motion roles, changesetsuiproject, which CI shards four waysinteractive-guard.test.mjs, theastryx experimental theme preview app xcase ran past its 20 s deadline under machine load. This pull request changes no CLI codespecs:for --diffPublic and internal API delta
segmented.lift: a spring (response 0.25 s, damping ratio 1) in the internal motion-role table, besidesegmented.selectionSpring.spec:AST-094FR4 lists it. Usage:this.springLens(lifted, this.springFrom(lifted, 'lift')). Why: the lift and its settle use UISegmentedControl's measured spring.segmentedControl.liftGrowth:[24, 16]px. Usage:const [width, height] = segmentedControl.liftGrowth;. Why: UISegmentedControl's measured growth while pressed.SegmentedSelectionMotion.highlighted(): SegmentedControl's touch tracking calls it when a press highlights. Usage:if (isHighlighted) motion.highlighted();. Why: the lift starts at the press highlight, as Switch's does. Nothing outside SegmentedControl calls it.--shadow-lowtoken into the lens's existingbox-shadowlayer property. No custom property is added./pages/segmented-control-cases/page, measured against main with the same page.