Skip to content

fix(chat): a selection made while the bar shows has its bar too - #1309

Merged
leookun merged 1 commit into
mainfrom
fix/selection-bar-every-drag
Nov 25, 2026
Merged

leookun merged 1 commit into
mainfrom
fix/selection-bar-every-drag

Conversation

@leookun

@leookun leookun commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #1301. In a recording (Windows), only every other drag in the conversation got the Copy / Quote / By the Way bar: a drag begun while the bar still showed never had one; the next (no bar showing) did.

Cause. The history's Listener hears a press first (it is deeper): _handlePointerDown hides the bar, then, as the press may select, sets _pointerSelects = true, and the selection starting schedules the bar. The old bar's TapRegion is still mounted in that event (it is rebuilt only on the next frame), and the TapRegionSurface higher up then reports the same press to it as one outside: onTapOutside → _hideBubble() → _pointerSelects = false, so nothing shows for the whole drag.

Fix. _handlePointerDown records the press's pointer; the bar's onTapOutside ignores that press (a press elsewhere in the app still hides the bar).

Test (test/chat/history_selection_test.dart): a second drag while the bar shows has a bar, over the second paragraph; a press outside the history takes it away. Without the fix: no bar found. history_selection_test, user_message_selection_test, markdown_preview_test, message_edit_visibility_test, sticky_message_test pass (but for the known pending-timer failure of the first test in message_edit_visibility_test on main).

🤖 Generated with BaoCode

Only every other drag had the bar over its selection. A press in the
history takes the bar away and, as it starts a selection, has it come
back; the bar's tap region then heard the same press (it hears it later,
being higher up), as one outside it, and took it away again for the
whole drag. The next drag, no bar showing, had one. It now leaves the
history's own presses to the history.

Test: a second drag while the bar shows has its bar, over its text; a
press outside the history still takes it away. It failed before (no bar).

Co-Authored-By: BaoCode <noreply@baocode.dev>
@leookun
leookun merged commit 2ea469d into main Nov 25, 2026
3 checks passed
@leookun
leookun deleted the fix/selection-bar-every-drag branch November 25, 2026 06:42
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.

2 participants