Skip to content

fix: stop stray sideways wheel input from sliding a closed side panel - #35174

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
fix/34769-closed-panel-swipe-start-distance
Nov 12, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
fix/34769-closed-panel-swipe-start-distance

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: On desktop, a closed side panel stays closed until the person opens it: a stray sideways wheel run, such as a mouse thumb wheel turning by a pixel at a time, no longer slides it out and back.

On the chat page, with the right side panel closed, the panel slides out 20 to 50 px and back on its own, several times an hour. The reporter traced it to a mouse with a horizontal thumb wheel (Logitech MX Master 3S): the wheel turns a little while the mouse is held or moved and sends runs of 0.83 to 1.67 px leftward wheel steps that sum to about 28 px. The first such step started a drag that pulled the panel out, and the drag fell back under the commit line a moment later.

Why it matters

Anyone whose mouse or input driver leaks small sideways scroll sees the closed panel flicker in and out at random while reading or typing, with no way to tell what caused it. The Bots page has the same drag on its own side panel and the same symptom.

Not a goal

  • The second trigger in the report, the panel mounting after the window regains focus with no wheel input: its cause is not established, so it is not changed here.
  • Telling a mouse wheel from a trackpad, or a setting that turns the desktop drag off.
  • How an open panel's close drag starts, or how a new run grabs a settle already in flight: both still follow from the first event.

What changed (motivation → approach → change)

A stray thumb-wheel run moved the closed panel because a leftward run started a drag at its first event, with no minimum travel, and the chat page accepts any leftward run while the panel is closed.

The swipe reader (hooks/useTrackpadSwipe) now takes a reveals answer from the page for each run. A run that would bring a closed panel out is read like a drag from its first event (so the browser's own swipe does not start under it, and its momentum tail is recognised as usual), but it starts only once the fingers' own travel reaches SWIPE_THRESHOLD_PX (80 px), the distance a reduced-motion swipe already needs; the panel then follows from that point. The fingers' moves before 80 px are handed to the page with the start, so the release reads their real speed and a quick flick that just passes 80 px still opens the panel. In the desktop app a pause with the fingers still down keeps that run, as it keeps a drag, up to the same 1 s cap. A lift-off or a recognised tail before 80 px ends the run unstarted. The chat page and the Bots page both answer reveals for a leftward run from rest; on the Bots page that also covers bringing its Dashboard tab forward. On the chat page, a run retired before it reaches 80 px (a session switch, the panel toggled) does not start a drag.

Run, panel closed Before After
Thumb-wheel creep, ~28 px slides out ~28 px and back nothing moves
Leftward flick under 80 px of finger travel could open the panel nothing moves
Deliberate leftward swipe follows from the first event follows once the fingers pass 80 px
Quick flick just past 80 px, then momentum opens opens (its speed before 80 px counts)
Rightward close of an open panel, or a grab mid-settle follows from the first event unchanged

The owning spec (website/docs/narrow-viewport.md) and the feature map row state the start distance.

Backwards compatibility

Compatible: reveals is an optional option of useTrackpadSwipe and an optional argument of createTrackpadSwipeReader; a page that does not pass it behaves exactly as before. For the person, opening a closed panel by trackpad now takes 80 px of finger travel, so a leftward flick shorter than that, which could open it before, no longer does.

Removes nothing: no option, path or stored state is removed; only how far an opening run must go before it moves changes.

Tests

  • useTrackpadSwipe.test.ts: the reporter's fine-step run (22 events, ~28 px) on a revealing run starts no drag and moves nothing, though every event is the page's; a 10 px x 12 run starts at the event that reaches 80 px, moves 0, 10, 20, 30, 40 from that point and hands over the sums before it (-70 to -10 px, with their times); a step that crosses 80 px moves by what lies past it; a rightward run is no reveal and starts at its first event, with no lead.
  • useTrackpadSwipe.test.ts: fingers that stop short of 80 px are never started by what follows them: a geometric momentum tail, a creeping tail, or (in the desktop shell) the momentum after a lift-off, read straight off the reader and through the hook's lift.
  • useTrackpadSwipe.test.ts: in the desktop shell, 50 px, a 300 ms pause with the fingers down, then 30 px more: the drag starts at the event that reaches 80 px in all, with the moves before the pause in its lead.
  • ChatPage.trackpadSwipe.test.tsx: the creep never mounts the closed panel's column; a session switch while an opening run is still short of 80 px drops the run; a quick flick (5, 15, 30, 40 px, then momentum) opens the panel.
  • MembersPage.sidePanel.trackpadSwipe.test.tsx: the creep never slides the hidden Bots panel out; the same quick flick opens it.
  • Existing opening cases on both pages first cover exactly 80 px in steps of their own size, so they still pin the drag, release and settle rules they were written for; the cases that swipe back during a fast open cover it slowly, so the open still commits with the panel partly in; the rule C and 10% flick titles say "past the start distance".

Determinism: the three changed files passed 20 runs at one worker and 10 at three workers, each with files and tests shuffled under a fresh printed seed (--sequence.shuffle.files --sequence.shuffle.tests --sequence.seed=<n>), 127 tests each time.

Proof: not provable -- frontend test (prove.py runs Python only)

Manual verification

Ran the built SPA in Chromium at 1440x900 (every /api/** call answered from fixtures, no gateway) with the chat page's side panel closed. A page script sent the reporter's creep over the transcript (22 leftward wheel events of 1.67/0.83 px, 45 ms apart, 28.3 px in all), then a deliberate swipe (16 x 20 px, 16 ms apart), and read the panel column's width on every frame.

Base build This branch
Creep: widest the closed panel's column got 28 px (slid out, then back) 0 px (never mounted)
Deliberate 320 px swipe opened (460 px) opened (460 px)

The three new tests fail on the base code (the reader starts a drag at the first creep event; the chat column and the Bots panel mount) and pass here.

Screenshots / video

The change is motion, what a stray run no longer does, so each build is recorded: the creep first, then the deliberate swipe.

Before (base build):

before-recording.webm

After (this branch):

after-recording.webm
Mid-creep, right edge (base) Mid-creep, right edge (this branch) After the deliberate swipe (this branch)
Mid-creep, right edge, this branch After the deliberate swipe, this branch

Related Issues

Closes #34769

Sibling sweep

Swept: git grep -n "useTrackpadSwipe(" -- website/src
Sibling: website/src/pages/members/useMembersPageDrawers.ts -- changed here
Sibling: website/src/hooks/useDrawerSwipe.ts -- not affected -- the phone drawer is a touch drag that already waits for AXIS_LOCK (10px) before it moves, and a stray wheel never reaches it

Pattern harvest

Rule candidate: review-prompt
Pattern: a gesture that moves a hidden surface from its first input event, with no start distance, so stray input reveals it

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@KiroCrewCaptain

KiroCrewCaptain commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider thinks the change is probably fine but estimates a 14% chance that this change introduces a defect, above the 12% limit for approving on its own.

Adds an 80px start distance to leftward runs that would bring a closed side panel out (the new reveals option), on both the chat and Bots pages. I traced the reader in the code without running it. The reporter's stray-wheel run (~28px) never trips tail detection and never starts a drag. Pauses with the fingers down keep a run that hasn't started yet, both in the reader's fingers-down check and in onQuiet, which fixes the earlier GPT finding. An early lift holds the rest of the run, so its momentum never starts it. The moves before 80px are passed with the start, so the speed-commit and release rules see the real speed. Paths that start at the first event (rightward close, grabbing mid-settle, reduced motion) are unchanged. The chat page guards against a session switch or panel toggle during the first 80px via runLive. Only two callers exist, and both are updated. Tests cover the stray-wheel run, quick flick, early stop, pause, early lift and session switch. The spec and feature map are updated.

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit 6942e0dab2 · 388 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 11, 2026
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 6942e0dab28ddae1180ac5605e3f8c970906acdb — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

No design-level concerns: the change fixes the real cause, which was a reveal with no minimum travel. It is opt-in per page and has rendered evidence attached.

Notes

  • A deliberate open now has an 80 px dead zone before the panel follows the fingers, so it feels slower to start. This is reversible. If it feels sluggish to users, a smaller reveal-only threshold kept separate from SWIPE_THRESHOLD_PX would let the two be tuned on their own.

[DESIGN-REVIEWED] 6942e0d

Description read

[DESCRIPTION-READ] 586f56f55322af4dd2787065548e216e95ff1903d7cf90a76f66d3f780676628

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 6942e0dab28ddae1180ac5605e3f8c970906acdb — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks. The PR adds no visible control; it only changes when a gesture starts. The before and after recordings are attached, and the stills show that the creep no longer leaves a strip at the edge.

Notes

  • A deliberate swipe to open the panel now moves nothing for the first 80 px of finger travel, so on a trackpad the panel may feel slow to respond. A human should watch the after recording and check that the panel starts moving from where it rests, without a jump.

[UX-REVIEWED] 6942e0d

Description read

[DESCRIPTION-READ] 565efcf56ab1045f5b20711ab418a13926b41e6ced205ad3e27750f6244da2d2

That sha256 names everything this verdict read: the PR description, plus the 6 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 6942e0dab28ddae1180ac5605e3f8c970906acdb — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 6942e0d

Verdict parsed from the review's SHA-scoped output markers for commit 6942e0dab28ddae1180ac5605e3f8c970906acdb.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 6942e0dab28ddae1180ac5605e3f8c970906acdb false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 6942e0dab28ddae1180ac5605e3f8c970906acdb and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 6942e0d

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 6942e0dab28ddae1180ac5605e3f8c970906acdb false-positive: <reason, 20 to 500 characters>

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

Request changes on 7644da2. A leftward run that would bring a closed side panel out (chat page and Bots page) is consumed like a drag but moves nothing until the fingers' own travel reaches 80px, so a mouse thumb wheel's ~28px creep no longer slides the panel out. Closes, mid-settle grabs and reduced motion are unchanged. Decisive lines: website/src/hooks/useTrackpadSwipe.ts:234-240 (report(): a waiting reveal starts only at SWIPE_THRESHOLD_PX, moves count from origin), website/src/hooks/useTrackpadSwipe.ts:283 (waiting = owner === 'drag' && reveals(dir)), website/src/hooks/useTrackpadSwipe.ts:218 (finish() returns false for an unstarted reveal, so no onDragEnd and no flush), website/src/pages/chat/page/chatTrackpadSwipe.ts:156,170 (reveals only from rest; a run retired before the threshold does not start), website/src/pages/members/useMembersPageDrawers.ts:596

A leftward wheel run started the desktop side-panel drag at its first
event, with no minimum travel, and both the chat page and the Bots page
accept any leftward run while their panel is closed. A mouse thumb wheel
that turns a pixel at a time while the mouse is held sends exactly such
runs (0.83-1.67px steps, about 28px in all), so the closed panel slid out
and back several times an hour with no deliberate input.

The swipe reader now asks the page whether a run reveals a closed panel.
Such a run is read like a drag from its first event, but starts only once
the fingers' own travel (never a momentum tail) reaches
SWIPE_THRESHOLD_PX, the 80px a reduced-motion swipe already needs, and
the panel follows from there; the fingers' moves before that point are
handed to the page, so the release reads their speed and a flick that
just passes it still opens the panel. A lift-off or a recognised tail
before that ends the run unstarted. A close, or a grab of a settle in
flight, still starts at once. On the chat page a run retired (session
switch, panel toggled) before its start distance no longer starts a
drag. The spec and feature map state the start distance.

Closes #34769
@bolichen97
bolichen97 force-pushed the fix/34769-closed-panel-swipe-start-distance branch from 7644da2 to 6942e0d Compare November 12, 2026 01:28
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Preserve pending reveals during finger-down pauses span=ecc5724ad16f

fixed in 6942e0d: the quiet timer's finger-down hold in settle now covers a reveal still short of 80 px (live === 'drag' || reader.waitingReveal()), the same hold the reader's own holding rule gives it in feed.
A pause with the fingers down keeps the run's travel until the next event, the lift-off, or FINGER_HOLD_MAX_MS, after which the reveal ends unstarted as before.
Regression test: useTrackpadSwipe.test.ts "a reveal short of its distance survives a pause with the fingers down, and starts at 80px in all" (50 px, 300 ms pause, 30 px): red on 7644da2, green on 6942e0d.
[operator: bolichen97]

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • a waiting reveal ends at the quiet timer during a finger-down pause span=64632baa7be4

fixed in 6942e0d: settle takes the finger-down hold for a waiting reveal too (fingers === true && (live === 'drag' || reader.waitingReveal()) && paused < FINGER_HOLD_MAX_MS), so 50 px, pause, 50 px keeps one run and starts at 80 px.
waitingReveal() reads owner === 'drag' && waiting, so a run already finished or held never matches; reduced motion and the browser path (no finger phases) are unchanged.
Regression test: useTrackpadSwipe.test.ts "a reveal short of its distance survives a pause with the fingers down, and starts at 80px in all": red on 7644da2, green on 6942e0d.
[operator: bolichen97]

@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97] @buluoray thanks for the review on 7644da2. Your summary matches the change, and the review names no separate defect, so here is what moved since:

  • The one defect both AI lanes upheld on that head is fixed in 6942e0d: in the desktop app, a pause with the fingers down no longer ends an opening run that is still short of 80 px, so 50 px, a pause, then 50 px opens the panel.
  • A local review found a second one in the same start, also fixed there: the start dropped the fingers' speed, so a quick flick that only just passed 80 px fell back closed. The start now lands at 80 px exactly and hands the page the fingers' moves before it, so the flick opens the panel on both pages. Each fix has a test that fails on 7644da2.

If something else made you request changes, could you name it here? Otherwise a re-review on the new head would clear the request.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 12, 2026
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 6942e0dab28ddae1180ac5605e3f8c970906acdb — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. The fix adds a start distance where the drag begins, has a linked issue (#34769), and reuses the existing SWIPE_THRESHOLD_PX instead of adding a new constant.

What this change ships

Inventory (10 items) — 10 justified

Intent: stop a mouse thumb wheel's small sideways creep from sliding a closed desktop side panel out and back. This is a FIX.

  1. Chat page: a closed side panel stays still until a leftward run has travelled 80 px — justified
  2. Bots page: the hidden side panel stays still until the same 80 px — justified
  3. Bots page: the Dashboard tab comes forward only after 80 px of leftward travel — justified
  4. A leftward flick shorter than 80 px no longer opens a closed panel — justified
  5. A quick flick just past 80 px still opens, because the finger moves before the start count toward release speed — justified
  6. Desktop app: pausing with fingers down keeps a not-yet-started opening run alive, up to 1 s — justified
  7. Lifting off, or a momentum tail, before 80 px ends the run with nothing moved — justified
  8. Chat page: a run cut off before 80 px (session switch, panel toggled) starts no drag — justified
  9. New optional reveals option on the swipe hook and reader; 2 consumers (chatTrackpadSwipe.ts:157, useMembersPageDrawers.ts:596) — justified
  10. The owning spec and the feature-map row now state the 80 px start distance — justified

[FIRST-PRINCIPLES-REVIEWED] 6942e0d

Description read

[DESCRIPTION-READ] 0b70c763d55b58dd911c172c7ab81c0940033029fed6f4a43fa5f99d23be87d9

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 12, 2026

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

Approve on 6942e0d. The point we raised on 7644da2 is fixed. In the desktop app, a slow leftward swipe that pauses with the fingers still down now keeps its progress toward the 80px start distance, so it opens the panel once the fingers carry on. A test pins this and fails when the fix is taken out. This head also starts the drag at exactly 80px and keeps the moves before that point for the release speed, so a quick flick that only just passes 80px opens the panel. A reveal that is lifted short of 80px stays unstarted while its momentum runs out. Each of these changes has a test that fails without it. Stray sideways input from a mouse wheel still never moves a closed panel. The only red checks are backend tests that were red on main when this CI ran, so the PR needs a rebase onto main before it can merge. Decisive lines: website/src/hooks/useTrackpadSwipe.ts:606 (settle keeps the finger-down hold for a waiting reveal), website/src/hooks/useTrackpadSwipe.ts:264 (the reader's own gap check holds any owner === 'drag', a waiting reveal included), website/src/hooks/useTrackpadSwipe.ts:244-258 (report() starts at exactly 80px and hands over the lead), website/src/hooks/trackpadPanelDrag.ts:108 (leadTrackpadSamples), website/src/hooks/useTrackpadSwipe.test.ts:574, website/src/hooks/useTrackpadSwipe.test.ts:599

@bolichen97 bolichen97 closed this Nov 12, 2026
auto-merge was automatically disabled November 12, 2026 07:27

Pull request was closed

@bolichen97 bolichen97 reopened this Nov 12, 2026
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 12, 2026
@bolichen97 bolichen97 closed this Nov 12, 2026
@bolichen97 bolichen97 reopened this Nov 12, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97] The red Backend Tests shards (3.12 5 and 6, Windows 2 and 4) and the Coverage Gate behind them on 6942e0d were main's, not this PR's: the same jobs were red on main's own push runs, on test_wait_discipline_ratchet (a short wait in test/test_update_boot_apply.py) and test_updates_handlers_facade. #35625 fixed both on main. CI tests the merge of this head into main, so I closed and reopened the PR to refresh that merge; CI is re-running on 6942e0d merged into 9ae8d25, which carries the fix. The branch and its diff are unchanged, so @buluoray's approval on 6942e0d still stands.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 12, 2026
@KiroCrewCaptain
KiroCrewCaptain merged commit fa8a4d7 into main Nov 12, 2026
207 of 265 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the fix/34769-closed-panel-swipe-start-distance branch November 12, 2026 09:46

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified on head 6942e0d: PR Readiness is green. The diff is frontend and docs only and touches no auth, sandbox or secret surface. The new reader states were traced by hand, including the start at 80px with the lead samples and the lift and finish paths. Mutating each changed production branch turned at least one test red, and three shuffled runs stayed green.
Done well: a stray thumb-wheel creep stays an owned, consumed drag that moves nothing. A flick that only just passes 80px still opens the panel because the earlier finger moves carry its speed. The reporter's own capture is pinned as a test on both pages.
Optional:

  • Add one Bots page test: open the panel on another tab, send the 28px creep, and assert the Dashboard tab stays unselected. Today no test fails if reveals stops covering that case.
  • The window-focus trigger in #34769 is out of scope here and has no other open issue. Use Part of #34769, or open a follow-up issue, so the next focus capture has an open place to go.
  • Open PR #27419 edits the same wants/onDragStart region and removes the Dashboard jump. Whichever PR merges second must resolve the conflict and drop the Dashboard jump wording from the comment, the feature map row and narrow-viewport.md.

@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chat: closed side panel slides out and back on its own on desktop (trackpad-swipe drag, v0.12.0+)

3 participants