Skip to content

fix(SegmentedControl): a tap in a wrapped track selects the segment it lands on - #12358

Merged
cixzhang merged 4 commits into
mainfrom
fix/segmented-wrapped-tap-target
Nov 20, 2026
Merged

cixzhang merged 4 commits into
mainfrom
fix/segmented-wrapped-tap-target

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Primary intent

Bug fix: a tap on a SegmentedControl segment selects that segment when a caller's style wraps the segments onto two rows.

Fixes #11860.

User impact

  • People tapping a wrapped SegmentedControl (a caller's CSS lets the track wrap, for example five options in a narrow container) got the wrong option: a tap on the first option of row 2 selected the option above it in row 1, about 300 ms later.
  • After: the tap selects the option under the finger or pointer. A single-row control behaves exactly as before.

Expected behavior and authority

  • component:SegmentedControl FR3: "A tap selects through the segment's click when its lift lands on that segment." The lift target was resolved from the horizontal position only, so in a wrapped track it could name a segment in the other row.
  • FR3 also keeps a held pointer on the control's center line, clamped to its end segments, so a drag or a lift off the control still commits by horizontal position. That rule is unchanged where no segment holds the lift: the new test applies when the lift lands inside a segment's own box or, under touch, its hit band (a tap just below a two-row control, on a lower-row segment's band, selects that segment).

The change

  • useSegmentedTouchTracking.ts: measureSegments also records each segment's top and bottom. The press tracker moves the point it hands resolveTarget onto the control's center line, so the new createSegmentLiftTarget keeps the pointer's own position from the tracker's onMove. liftTargetAt first commits the segment whose own box holds that position, then, under touch, the segment whose hit band holds it (own boxes win, so a band never takes a press on a neighbor; nothing if that segment is disabled); otherwise it falls back to the existing horizontal rule on the center line, which still handles the gaps between segments, the padding, and a held pointer that drifts off the control.
  • No API, default or DOM change.

Not in this change

  • The selected indicator measured while the options sit on one row, so in a wrapped track it can sit off the selected option. component:SegmentedControl FR5 describes a one-row control whose labelled segments shrink, and no record covers a wrapped track's indicator, so that part is left for a spec decision.

Evidence

  • Red first, through the tracker: useSegmentedTouchTracking.test.ts "a lift through the tracker, when a caller wraps the segments" drives createActionGroupTracker with the control's own lift target on a two-row and a three-row track. With the box test reading the tracker's center-line point (the wiring before this change), a tap on row-2 E commits B and, in three rows, a tap on row-1 B commits E. With this change each tap commits the segment it lands on, including a tap 2 px below a second-row segment, on its touch band (on the previous head that tap still committed the segment above).

  • Unchanged paths: every SegmentedControl unit suite passes (133 tests), including the single-row lift, gap, padding, disabled and touch-band cases.

  • Mouse and touch in Chromium (149, production Storybook build of 53759d2, which this head extends to the touch band, and of its base, five options with caller CSS [role="radiogroup"] { flex-wrap: wrap }, 390 × 844 viewport; the selection moved to another option by keyboard before each press; aria-checked read 400 ms and 1 s after):

    Layout Press Pointer Base This change
    358 px, two rows first option of row 2 mouse the row-1 option above it the option pressed
    358 px, two rows first option of row 2 touch the row-1 option above it the option pressed
    250 px, three rows a row-1 option touch the option pressed the option pressed
    250 px, three rows first option of row 2 touch a row-1 option the option pressed
    250 px, three rows first option of row 3 touch a row-1 option the option pressed
  • Browser specs for SegmentedControl (SegmentedControl.interaction.browser.spec.ts) run in CI; the local machine cannot launch Playwright.

Credit

Reported by @duytbp, with the five-option, 358 px reproduction this test follows.

…t lands on

liftTargetAt resolved the lift by horizontal position only, so when a caller's style wraps the segments onto two rows, a tap on a second-row segment committed the segment above it (component:SegmentedControl FR3). The lift now commits the segment whose own box holds it, and falls back to the horizontal rule for gaps, padding and a held pointer.

Fixes #11860
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 17, 2026
@vercel

vercel Bot commented Nov 17, 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 Nov 19, 2026 10:16am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 19, 2026, 10:45 PM UTC

@cixzhang cixzhang added the lane:3 Astryx fix-loop lane 3 owns this label Nov 17, 2026
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 24b5bca

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
SegmentedControl 102.5 kB (+158 B) · 6.9 kB CSS (0) — ✗ · ✓ · ✓
SegmentedControlItem 18.8 kB (0) · 4.3 kB CSS (0) — ✗ · ✓ · ✓
DateTimeInput 224.6 kB (+183 B) · 19.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) · inheritance unknown: not found in the 8 newest reports of other pull requests before frame after frame diff frame

Inheritance checked against the 8 newest reports of other pull requests.

Package size: @astryxdesign/core 7.64 MB packed (+1.2 kB); no new dependencies.

Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec f4ab372

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

Changes requested: the new own-box test never sees where a tap lands, so the wrapped-track bug from #11860 is still there, and three-row tracks get a new mis-selection.

  • liftTargetAt's own-box test (useSegmentedTouchTracking.ts:143-154) receives the point the press tracker has already moved onto the track's center line (actionGroupTracker.ts:337-342), so tapping or clicking a second-row segment on the reported two-row layout still selects the segment above it.
  • In a three-row wrapped track the center line falls inside row 2, so a tap or click on a first-row segment, which works on main, now selects the row-2 segment below it.
  • Mouse and pen presses take the same path, and the spec approval on this head covers the FR3 ruling, but the description still needs mouse or trackpad before and after results in its text (for example, a mouse click on Year in the two-row 358 px layout, on main and with the fix).
  • The title, the changeset and "Fixes #11860" say a wrapped tap now selects the segment it lands on, which this head does not do, so the release note would announce a fix and merging would close the issue while its reproduction still fails.

One code change should clear the first, second and fourth points: run the own-box test on the unprojected lift point, which the tracker already reports through its onMove option, and cover it with a test that goes through the tracker (or a browser spec) on two- and three-row layouts. Then add the mouse result to the description.

Claims and files checked

Review mode: same-head; reason: none

  • Changeset: a tap in a track wrapped onto two rows selects the segment it lands on: false; in Chromium a tap or click on the second-row segment still selects the one above it.
  • Description: before the change the lift target came from the horizontal position only: verified; the base liftTargetAt calls segmentTargetAt(x).
  • Description: after the change a tap selects the option under the finger or pointer, fixing #11860: false, same browser run.
  • Description: a single-row control behaves exactly as before: verified; the center line lies inside every segment of one row, and the single-row lift, gap, padding, disabled and touch-band tests pass.
  • Description: the held-pointer center-line rule is unchanged and the box test applies only when the lift lands inside a segment's box: partly false; the rule is unchanged, but the tracker applies it to the lift before the box test runs.
  • Description: measureSegments records top and bottom, and liftTargetAt tests the own box first and commits nothing over a disabled segment: verified (useSegmentedTouchTracking.ts:70-84, :143-155).
  • Description: no API, default or DOM change: verified; the API report shows no change for Core or the themes, and no markup changes.
  • Description: the wrapped indicator is left out: verified; useSegmentedSelectionMotion.ts is unchanged.
  • Description: the new test fails on main and passes here: verified (expected "e", received "b" on main), but it calls liftTargetAt directly with a point the tracker never passes.
  • Description: every SegmentedControl unit suite passes (131 tests): verified.
  • Description: the SegmentedControl browser specs run in CI: not run at this head; CI skipped every test job on the draft.
  • Description: the test follows the reporter's five-option, 358 px reproduction: verified against #11860.
  • .changeset/segmented-wrapped-tap-target.md: finding; announces a fix the head does not deliver.
  • packages/core/src/SegmentedControl/useSegmentedTouchTracking.ts: findings; the own-box test runs on the center-line point; first-row regression in three-row tracks for touch and mouse.
  • packages/core/src/SegmentedControl/useSegmentedTouchTracking.test.ts: finding; tests the helper with the raw point only, so it cannot catch the tracker path.

Automated review (maintainer link)

…y is

The press tracker moves the point it gives resolveTarget onto the control's center line, so the box test never saw a second-row tap, and in a three-row track it moved a first-row tap into row 2. createSegmentLiftTarget keeps the pointer's own position from the tracker's onMove and runs the box test on it; the horizontal rule still reads the center line. The tests drive the tracker on two- and three-row tracks.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 53759d2

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

Changes requested: a tap or click inside a wrapped segment now selects it, but under touch a tap on a lower-row segment's touch band still selects the segment above it.

  • The own-box test in liftTargetAt (useSegmentedTouchTracking.ts:146-154) checks each segment's visual rect only, so a finger on a second-row segment's hit band (for example 2 px below Year in the two-row 358 px layout, still inside the control) falls back to the center-line rule and selects the segment above it after the click wait, as in #11860; testing the pointer against each segment's banded box as measureLiftArea measures it, and adding a wrapped band case to the tracker test, would fix it.

The earlier findings are fixed: the box test reads the pointer's own position through the tracker's onMove, first-row taps in three-row tracks keep their segment, and the description states the mouse results. Two optional points: the file header's @output does not list createSegmentLiftTarget, and "Fixes #11860" will close the issue while its indicator offset, which this change leaves out, stays open.

Claims and files checked

Review mode: incremental; reason: none

  • Changed rules (0): none.
  • Changeset, a tap in a track wrapped onto two rows selects the segment it lands on: verified for taps and clicks inside a segment (Chromium: Year selects Year; the base selects Week); false for a touch on a second-row segment's hit band, which still selects the segment above.
  • Description, before the change a tap on the first option of row 2 selected the option above it: verified on the base, in the browser and through the tracker.
  • Description, the tap now selects the option under the finger or pointer: verified inside the segment for touch and mouse; false on the hit band, as above.
  • Description, a single-row control behaves as before: verified; a single-row band tap selects its own segment on both trees, and the single-row unit cases pass.
  • Description, the lift target used to come from the horizontal position only: verified; the base's lift rule chooses by x.
  • Description, the held-pointer center-line rule is unchanged and the box test applies only when the lift lands inside a segment's box: verified (useSegmentedTouchTracking.ts:146-158); in a wrapped track a drag that lifts on another row's segment now commits it, which the requirement's drag clause covers.
  • Description, segments record their top and bottom, and the lift target keeps the pointer's own position from the tracker's move callback: verified (:70-84, :169-181, :277).
  • Description, the box test commits nothing over a disabled segment and otherwise falls back to the horizontal rule: verified (:155-158).
  • Description, no API, default or DOM change: verified; the API generator lists no rows for Core, build or the themes, and no markup changes.
  • Description, the wrapped indicator is left out: verified; the selection-motion module is unchanged.
  • Description, red first through the tracker (with center-line wiring, a row-2 tap commits the segment above and a three-row first-row tap the segment below): verified with a tracker run.
  • Description, every SegmentedControl unit suite passes (132 tests): verified.
  • Description, mouse and touch results in Chromium for two- and three-row layouts: verified for the rows reproduced (two rows by touch and mouse; first and third rows of three by touch).
  • Description, the SegmentedControl browser specs run in CI: not run at this head; CI skipped every test job on the draft.
  • .changeset/segmented-wrapped-tap-target.md: finding; overstates the fix for touch-band taps until the code covers them.
  • packages/core/src/SegmentedControl/useSegmentedTouchTracking.ts: finding; the box test ignores the hit band; non-blocking header note.
  • packages/core/src/SegmentedControl/useSegmentedTouchTracking.test.ts: clear; drives the tracker on two- and three-row layouts.

Automated review (maintainer link)

…s that segment

The own-box test read only each segment's visual box, so under touch a lift on a lower-row segment's hit band fell back to the center-line rule and committed the segment above it. measureSegments also records each segment's banded box, and the lift tests the own boxes first, then the bands, so a band never takes a press that lands on a neighbor.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 6ab5abe

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

Changes requested: a tap in a wrapped track now selects the segment it lands on, its touch band included, but one sentence in the description no longer matches the code.

  • The description's "Expected behavior and authority" bullet says a drag or a lift off the control still commits by horizontal position and that the new box test applies only inside a segment's own box, but at this head the lift also tests each segment's touch band (useSegmentedTouchTracking.ts:162-166), so a tap just below a two-row control on a lower-row segment's band selects that segment rather than the one above it; please update that sentence to name the band.

The touch-band case from the last review is fixed and covered by the new tracker test, and the SegmentedControl interaction specs pass in Chromium, but CI has not run on this draft head yet. Two optional points: measureLiftArea could reuse the band measureSegments now records instead of measuring it again, and the file header's @output does not list createSegmentLiftTarget.

Claims and files checked

Review mode: incremental; reason: none

  • Changed rules (0): none.
  • Title, a tap in a wrapped track selects the segment it lands on: verified in Chromium for two and three rows, on the segment and on its touch band.
  • Changeset, when a page's style wraps the segments onto two rows a tap selects the segment it lands on, not one in the other row: verified as above; the credit names the issue's reporter.
  • Description, before the change a tap on the first option of row 2 selected the option above it after a short delay: verified on the base with a tracker run, and in Chromium for the second option of row 2.
  • Description, the tap now selects the option under the finger or pointer: verified for touch on the segment and on its band; mouse behavior is unchanged since the last revision because a fine pointer has no band.
  • Description, a single-row control behaves exactly as before: verified; a one-row band tap renders identically on both sides, and the single-row unit and interaction cases pass.
  • Description, the quoted tap requirement and the cause (the lift target came from the horizontal position only): verified against the record and the base code.
  • Description, a drag or a lift off the control still commits by horizontal position and the new box test applies only inside a segment's own box: false at this head; a lift on a segment's touch band, including one just below the control, uses the new test.
  • Description, segments record their top and bottom, the lift keeps the pointer's own position from the tracker's move callback, own boxes win before touch bands, a disabled segment commits nothing, and the horizontal rule handles the rest: verified (useSegmentedTouchTracking.ts:72-92, :155-193).
  • Description, no API, default or DOM change: verified; the API generator lists no rows and no markup changes.
  • Description, the wrapped indicator is left out: verified; the selection-motion module is unchanged.
  • Description, red first through the tracker (the center-line wiring commits the segment above or below, and the previous revision commits the segment above for a band tap): verified with tracker runs and with the new test run against the previous revision.
  • Description, every SegmentedControl unit suite passes (133 tests): verified.
  • Description, the Chromium mouse and touch table: verified for the touch rows reproduced on this head (two rows; row 3 of three); the other rows were taken on the previous revision, whose in-box and mouse paths this head keeps.
  • Description, the SegmentedControl browser specs run in CI: CI has not run on this draft head; all 63 pass in Chromium.
  • .changeset/segmented-wrapped-tap-target.md: clear.
  • packages/core/src/SegmentedControl/useSegmentedTouchTracking.ts: clear; non-blocking notes on the repeated band measurement and the file header.
  • packages/core/src/SegmentedControl/useSegmentedTouchTracking.test.ts: clear; drives the tracker on two- and three-row tracks, a band tap included.

Automated review (maintainer link)

right: rect.right,
top: rect.top,
bottom: rect.bottom,
band: {

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.

Non-blocking: measureLiftArea (:217-225) computes this same banded box again after a second getBoundingClientRect per segment. Mapping segments to their band there would keep the lift area and this lift test on one measurement.

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

Approved pending CI: a tap in a wrapped SegmentedControl track now selects the segment it lands on, its touch band included, and the description now matches the code. CI has not run on this draft head yet; marking the pull request ready for review starts it, and the required checks must pass before merge.

Two optional points still stand: measureLiftArea could reuse the band measureSegments now records instead of measuring it again, and the file header's @output does not list createSegmentLiftTarget.

Claims and files checked

Review mode: same-head; reason: none

  • Changed rules (0): none.
  • Title, a tap in a wrapped track selects the segment it lands on: verified; the lift tests the pointer's own position against each segment's box, then its band (useSegmentedTouchTracking.ts:155-170), with tracker tests on two and three rows (useSegmentedTouchTracking.test.ts:199-227) and Chromium taps.
  • Changeset, when a page's style wraps the segments onto two rows a tap selects the segment it lands on, not one in the other row: verified as above; the credit names the issue's reporter.
  • Description, before the change a tap on the first option of row 2 selected the option above it after a short delay: verified; the base resolves by horizontal position only and then clicks that segment itself when no browser click lands on it.
  • Description, the tap now selects the option under the finger or pointer: verified for touch on the segment and on its band, and for a mouse click inside the segment.
  • Description, a single-row control behaves exactly as before: verified; the single-row unit cases pass and a one-row band tap renders identically on both sides.
  • Description, the quoted tap requirement and the cause (the lift target came from the horizontal position only): verified against the record and the base code.
  • Description, the horizontal rule still decides a drag or lift that no segment holds, and the new test covers a segment's own box or, under touch, its hit band, so a tap just below a two-row control on a lower-row band selects that segment: verified (useSegmentedTouchTracking.ts:162-170; Chromium tap below the control on Year's band selects Year).
  • Description, segments record their top and bottom, the lift keeps the pointer's own position from the tracker's move callback, own boxes win before touch bands, a disabled segment commits nothing, and the horizontal rule handles the rest: verified (useSegmentedTouchTracking.ts:72-92, :155-193).
  • Description, no API, default or DOM change: verified; the module is reachable from no package export and no markup changes.
  • Description, the wrapped indicator is left out: verified; the selection-motion module is unchanged.
  • Description, red first through the tracker, including the band tap on the previous revision: verified; the new tracker tests fail against the center-line wiring and on the previous revision.
  • Description, every SegmentedControl unit suite passes (133 tests): verified at this head.
  • Description, the Chromium mouse and touch table: verified for the touch rows reproduced on this head; the mouse rows hold on the previous revision, whose in-box path this head keeps.
  • Description, the SegmentedControl browser specs run in CI: CI has not run on this draft head; the SegmentedControl interaction specs pass in Chromium.
  • Description, fixes the linked issue: the reported tap is fixed; the issue's indicator offset stays open, as the description says.
  • .changeset/segmented-wrapped-tap-target.md: clear.
  • packages/core/src/SegmentedControl/useSegmentedTouchTracking.ts: clear; non-blocking notes on the repeated band measurement and the file header.
  • packages/core/src/SegmentedControl/useSegmentedTouchTracking.test.ts: clear; drives the tracker on two- and three-row tracks, a band tap included.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 19, 2026 09:37

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

Changes requested: the wrapped-track tap fix holds, but the changeset's credit line fails the required lint check now that CI has run on this head.

  • Found by CI: line 7 of .changeset/segmented-wrapped-tap-target.md reads Reported by @duytbp, which pnpm check:changesets does not count as a credit because it reads contributors only from a line of bare handles, so the required lint check fails; changing that line to @duytbp alone makes the check pass.

The other CI checks that have finished on this head pass, including the SegmentedControl interaction specs in Chromium and WebKit. Two optional points still stand: measureLiftArea could reuse the band measureSegments now records instead of measuring it again, and the file header's @output does not list createSegmentLiftTarget.

Claims and files checked

Review mode: same-head; reason: none

  • Changed rules (0): none.
  • Title, a tap in a wrapped track selects the segment it lands on: verified; the lift tests the pointer's own position against each segment's box, then its band (useSegmentedTouchTracking.ts:155-170), with tracker tests on two and three rows (useSegmentedTouchTracking.test.ts:199-227) and Chromium taps.
  • Changeset, when a page's style wraps the segments onto two rows a tap selects the segment it lands on, not one in the other row: verified as above.
  • Changeset, credits the issue's reporter: false as written; the credit line is not a bare-handle line, so the changeset check reads no contributor and the required lint check fails (scripts/changeset-entry-format.cjs:75).
  • Description, before the change a tap on the first option of row 2 selected the option above it after a short delay: verified; the base resolves by horizontal position only and then clicks that segment itself when no browser click lands on it.
  • Description, the tap now selects the option under the finger or pointer: verified for touch on the segment and on its band, and for a mouse click inside the segment.
  • Description, a single-row control behaves exactly as before: verified; the single-row unit cases pass and a one-row band tap renders identically on both sides.
  • Description, the quoted tap requirement and the cause (the lift target came from the horizontal position only): verified against the record and the base code.
  • Description, the horizontal rule still decides a drag or lift that no segment holds, and the new test covers a segment's own box or, under touch, its hit band, so a tap just below a two-row control on a lower-row band selects that segment: verified (useSegmentedTouchTracking.ts:162-170).
  • Description, segments record their top and bottom, the lift keeps the pointer's own position from the tracker's move callback, own boxes win before touch bands, a disabled segment commits nothing, and the horizontal rule handles the rest: verified (useSegmentedTouchTracking.ts:72-92, :155-193).
  • Description, no API, default or DOM change: verified; the module is reachable from no package export and no markup changes.
  • Description, the wrapped indicator is left out: verified; the selection-motion module is unchanged.
  • Description, red first through the tracker, including the band tap on the previous revision: verified; the new tracker tests fail against the center-line wiring and on the previous revision.
  • Description, every SegmentedControl unit suite passes (133 tests): verified at this head.
  • Description, the Chromium mouse and touch table: verified for the touch rows reproduced on this head; the mouse rows hold on the previous revision, whose in-box path this head keeps.
  • Description, the SegmentedControl browser specs run in CI: verified; the interaction suites passed in CI on this head.
  • Description, fixes the linked issue: the reported tap is fixed; the issue's indicator offset stays open, as the description says.
  • .changeset/segmented-wrapped-tap-target.md: blocking; the credit line fails the changeset check.
  • packages/core/src/SegmentedControl/useSegmentedTouchTracking.ts: clear; non-blocking notes on the repeated band measurement and the file header.
  • packages/core/src/SegmentedControl/useSegmentedTouchTracking.test.ts: clear; drives the tracker on two- and three-row tracks, a band tap included.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as draft November 19, 2026 10:06
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 24b5bca

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

Approved: a tap or click on a lower-row segment of a wrapped SegmentedControl, its touch band included, now selects that segment, and single-row controls behave as before.

CI passes on this head, including the SegmentedControl interaction specs in Chromium and WebKit and the new tracker tests.

Two optional points remain: measureLiftArea could reuse the band measureSegments now records instead of measuring each segment again, and "Fixes #11860" closes the issue while its indicator offset stays open, so a follow-up issue would keep that report alive.

Claims and files checked

Review mode: same-head; reason: none

  • Changed rules (0): none.
  • Title, a tap in a wrapped track selects the segment it lands on: verified; the lift tests the pointer's own position against each segment's box, then its touch band (useSegmentedTouchTracking.ts:156-171), with tracker tests on two and three rows (useSegmentedTouchTracking.test.ts:199-227) and Chromium taps and clicks on this head.
  • Changeset, a core patch fix: when a page's style wraps the segments onto two rows, a tap selects the segment it lands on, not one in the other row: verified as above; on the base the same taps select the segment above.
  • Changeset, credits the issue's reporter: verified; the changeset check passes in the lint job and reads the reporter's handle as the contributor.
  • Description, before the change a tap on row 2 selected the option above it after a short delay: verified; the base resolves the lift by horizontal position only and then clicks that segment itself when no browser click lands on it.
  • Description, the tap now selects the option under the finger or pointer: verified for touch on the segment and on its band, and for a mouse click inside the segment.
  • Description, a single-row control behaves exactly as before: verified; the single-row unit cases and the interaction specs pass, and a one-row band tap renders identically on both sides.
  • Description, the quoted tap requirement and the cause (the lift target came from the horizontal position only): verified against the record and the base code.
  • Description, the horizontal rule still decides a drag or lift that no segment holds, and a tap just below a two-row control on a lower-row band selects that segment: verified (useSegmentedTouchTracking.ts:163-171; Chromium, 4 px below the control).
  • Description, segments record their top and bottom, the lift keeps the pointer's own position from the tracker's move callback, own boxes win before touch bands, a disabled segment commits nothing, and the horizontal rule handles the rest: verified (useSegmentedTouchTracking.ts:73-93, :143-194).
  • Description, no API, default or DOM change: verified; the API comparison lists no change for any published package, and no markup changes.
  • Description, the wrapped indicator is left out: verified; the selection-motion module is unchanged.
  • Description, red first through the tracker, including the band tap on the previous revision: verified; with the box test fed the tracker's center-line point, the two-row tap commits the segment above and the three-row first-row tap commits the one below, and on the previous revision only the band tap fails.
  • Description, every SegmentedControl unit suite passes (133 tests): verified at this head.
  • Description, the Chromium mouse and touch table: verified on this head for all five rows.
  • Description, the SegmentedControl browser specs run in CI: verified; they pass on this head in Chromium and WebKit.
  • Description, fixes the linked issue: the reported tap is fixed; the issue's indicator offset stays open, as the description says.
  • .changeset/segmented-wrapped-tap-target.md: clear.
  • packages/core/src/SegmentedControl/useSegmentedTouchTracking.ts: clear; one optional note on the repeated band measurement.
  • packages/core/src/SegmentedControl/useSegmentedTouchTracking.test.ts: clear; drives the tracker on two- and three-row tracks, a band tap included.

Automated review (maintainer link)

@cixzhang
cixzhang merged commit 3dbf8ca into main Nov 20, 2026
150 checks passed
@github-actions
github-actions Bot deleted the fix/segmented-wrapped-tap-target branch November 20, 2026 06:05

This branch was successfully deployed

1 active deployment
Preview — 24b5bca1 Deployed Nov 19, 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. lane:3 Astryx fix-loop lane 3 owns this

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] SegmentedControl: in a wrapped layout, a press resolves its option by x only and then clicks the wrong one

1 participant