Skip to content

fix(web): a long press on an agent pill keeps its menu open on touch - #1050

Merged
badcuban merged 2 commits into
mainfrom
fix/agent-pill-touch-menu
Nov 23, 2026
Merged

badcuban merged 2 commits into
mainfrom
fix/agent-pill-touch-menu

Conversation

@badcuban

@badcuban badcuban commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Follow-up to #1048. On a touch screen, a long press on an agent pill in the model menu opened its menu, and lifting the finger closed it again. A phone had no way to rename or remove an agent.

The menu comes up under the finger that is still holding the pill. When the finger lifts, the browser follows it with a mouse press at that spot. That press now lands outside the menu, and the menu took it for a tap elsewhere.

The pill now cancels that close while the holding finger is down and for 400ms after it lifts. Later taps outside still close the menu. A new press on the open menu ends the hold, so a slow tap on Rename or Remove is still not timed as another hold on the pill.

The new browser test replays what a phone sends in the phone drawer: touch pointer events on the held element, then the mouse press and click on whatever is under the finger by then. It checks that a long press opens the menu and it stays open, a tap outside closes only the menu, and a slow tap on Rename opens the focused name box. It fails on main. The behavior was also checked once by hand with real touches through the devtools protocol.

The first version of the test used those real touches. On its CI run a hover test in another file failed in the same shard, so the test no longer puts the browser in touch mode. The link is not proven.

Not checked on a real phone. Known and left alone: a menu opened by touch, then Escape on a hardware keyboard, closes the drawer too.

On a touch screen, a long press on an agent pill in the model menu opened
its menu, and lifting the finger closed it again, so there was no way to
rename or remove an agent on a phone.

The menu comes up under the finger that is still holding the pill. When the
finger lifts, the browser follows it with a mouse press at that spot, which
now lands outside the menu, and the menu took it for a tap elsewhere.

The pill now cancels that close while the holding finger is down and for
400ms after it lifts. Later taps outside still close the menu. A new press
on the open menu ends the hold, so a slow tap on Rename or Remove is still
not timed as another hold on the pill.

The new browser test drives real touches through the devtools protocol:
faked pointer events don't send the mouse press that follows a lifted
finger, which is how this passed before.
@vercel

vercel Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
threadlines Skipped Skipped Nov 23, 2026 3:34pm UTC

Request Review

The test drove real touches through the devtools protocol, which puts the
whole test browser in touch mode for a while. On the PR's CI run a hover
test in another file (MessagesTimeline, "exposes a branch action on
completed assistant messages") failed a minute later in the same shard. It
passes locally in the same tab right after this test, so the link is not
proven, but that test has not failed in other recent runs.

The test now dispatches the same sequence itself: touch pointer events on
the held element, then the mouse press and click on whatever is under the
finger by then. It still fails on the old code and leaves the browser's
input mode alone.
@badcuban
badcuban added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit 48eae28 Nov 23, 2026
23 checks passed
@badcuban
badcuban deleted the fix/agent-pill-touch-menu branch November 23, 2026 15:47

This branch was previously deployed

1 inactive deployment
Preview — b369131c Deployed Nov 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant