Skip to content

fix(drawer): let selection handle drags through instead of opening the drawer - #57

Merged
Tarquinen merged 1 commit into
devfrom
fix-selection-opens-drawer
Nov 13, 2026
Merged

Tarquinen merged 1 commit into
devfrom
fix-selection-opens-drawer

Conversation

@Tarquinen

@Tarquinen Tarquinen commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Fixes anomalyco/opencode#63530

Bug: dragging a selection handle in an assistant reply could open the sessions drawer while the selection moved too. It happens whenever the handle sits in the leading 28 dp edge, which is any selection that starts at the beginning of a line.

Cause: the drawer's pan sees every touch first, and a drag from the edge always opens it. iOS skips touches on a selection handle (BackSwipeRules.selectionHandleClaims). Android never ported that check because it assumed Compose's handles consume their own drags, but the transcript draws its own handles (TranscriptReplySelection).

Fix:

  • When the drawer is shut, a touch within 24 dp of a reply selection handle never starts the pan, as on iOS. The transcript list registers its handles with a new Modifier.drawerPanSelectionHandles (backed by TranscriptReplySelection.handleAt), and SessionPageStack forwards it to the drawer.
  • The "a hold already began" check now uses positionChangeIgnoreConsumed(). positionChange() is always zero once a child has consumed the move, so the check could never pass.
  • Updated the stale comments and the parity rows.

Verified:

  • scripts/check.sh :core :feature:drawer :feature:transcript :feature:session passes on the Android VM.
  • Emulator with session-lab. I switched to 3-button navigation so the edge touch reaches the app instead of system back.
    • Before: long-pressing "transcript" (at the start of a line) and dragging the start handle right opened the drawer.
    • After: the same drag moves the selection and the drawer stays shut.
    • Edge and mid-screen swipes on the transcript still open the drawer, and long-press selection still works.
  • I couldn't land the hold fix's timing with adb input (a sideways sweep 0.40–0.45 s after the press), so that part is checked by reading the code only.

Before / after

Left: v0.6.4 release. Right: this branch. Emulator with session-lab, 3-button navigation.

pr57-before-after.mp4

Video: dragging the start handle of a selection at the start of a line opens the drawer before and only grows the selection after; then an edge swipe on the transcript still opens the drawer on both.

Before: the drawer slides open while dragging the selection handle. After: the selection grows and the drawer stays shut.

Mid-drag still: the drawer is half open on the left, while on the right the selection has grown to "and composer share the".

…e drawer

Dragging a reply selection handle that sits in the leading 28 dp edge
(any selection starting at a line start) opened the session drawer while
the selection moved too. The drawer's pan sees every touch first, and the
edge always wins; iOS skipped this with BackSwipeRules.selectionHandleClaims,
which Android never ported on the belief that Compose handles consume their
own drags (the transcript's handles are drawn by TranscriptReplySelection,
not Compose's popups).

- DirectionalPan: on a shut drawer, a touch within reach of a selection
  handle never starts the pan (iOS DirectionalPanGestureRecognizer).
- The transcript list registers its handles with the new
  Modifier.drawerPanSelectionHandles (TranscriptReplySelection.handleAt,
  24 dp reach); SessionPageStack forwards them to the drawer.
- hasBegunHold now reads positionChangeIgnoreConsumed(): positionChange()
  is zero once a child consumed the move, so the check could never pass.
- Stale "handles consume their own drags" comments and parity rows updated.

Verified: scripts/check.sh :core :feature:drawer :feature:transcript
:feature:session on the Android VM. Emulator (session-lab, 3-button nav so
the edge reaches the app): before, dragging the start handle of a
selection at a line start opened the drawer; after, the selection moves
and the drawer stays shut. Edge and mid-screen swipes on the transcript
still open the drawer; long-press selection still works.

Fixes anomalyco/opencode#63530
@Tarquinen
Tarquinen merged commit 5247be1 into dev Nov 13, 2026
3 checks passed
Tarquinen added a commit that referenced this pull request Nov 14, 2026
The transcript list was a port of iOS's UIKit TranscriptListViewController: a
top-anchored LazyColumn with ~6,000 lines of custom motion on top (a bottom
follower, jump glides, row growth from one pixel, growth rides, row entrances)
plus a snapshot flight from the composer into the list on every send. That
motion fought LazyColumn's own layout, and sending felt unlike any Android
texting app. The list's motion is now Android-native on purpose; behaviour,
flows and copy still follow iOS (noted in AGENTS.md and docs/parity).

The list
- LazyColumn(reverseLayout = true), newest row at index 0, so new and growing
  rows (a streaming reply) push older content up at the end with no follower.
- New rows at the end: requestScrollToItem(0) and AnimatedVisibility
  (expandVertically + fadeIn) on the M3 fast spatial spring.
- TranscriptListScroller holds the list's own scrolls: Jump to Latest (cut to a
  screen above the end when far, then one glide on M3 standard easing, 0.35 to
  0.55 s by distance), the borrowed drag, scroll to top, the New messages
  landing, and holding a toggled row in place mid-list (it grows upward at the
  end so the opened tools stay above the composer).
- Disclosures (tool groups, inner tool rows, reasoning, Show More) move their
  height on one disclosure spring; a closing body takes its gap with it.
  Rows use a flat press tint instead of the ripple, and tool headers are one
  line with the glyph on the first line.
- Rebuilt on the new list: reply selection and its autoscroll (reversed), the
  drawer's selection-handle exclusion (#57), New messages decide/fit/passed/
  read and the divider glow, FirstContentFrameRendered, scroll restore by row
  key after process death, earlier-history paging, header backdrop, Jump to
  Latest visibility, the image viewport, link previews, the agent reveal, the
  empty loading mark, TalkBack coalescing and the timeline gate.

The send
- No flight. The composer card resets in one motion: a picture of the old
  content fades out while animateContentSize(alignment = BottomStart) slides
  the top edge down on the same spring; the sent photos are decoded before the
  bubble's first frame. The list's bottom padding reads the composer height
  while measuring, so the list end moves with the card.

Deleted
- TranscriptListController, TranscriptRowGrowth, TranscriptRowEntrance,
  TranscriptScrollSprings, TranscriptScrollBehavior, TranscriptMotionTrace,
  NewDividerMotion, SessionSendFlight, SendLift, SentImageFlight, SendLanding,
  ComposerSendTransition (its swipe input moves to ComposerFieldLink), the
  composer's shrink-on-send, image/link-preview row growth, and the tuning
  knobs that only served them.
- Ported tests for that motion (TranscriptScrollBehaviorTests,
  TranscriptRowGrowthTests, TranscriptGestureReleaseTests, SentImageFlightTests,
  ComposerSendTransitionTests and individual growth/hand-off tests); each is
  listed as dropped in docs/parity.

78 files, +1,497 / -8,847 vs dev.

Verified
- scripts/check.sh (all modules) on the VM: build, lint and unit tests pass.
- Emulator with session-lab: button, IME and Ctrl+Enter sends, steer, Queue,
  failed send then Retry, a new session's first message, streaming, keyboard
  open/close, selection (a leading-edge handle drag doesn't open the drawer),
  New messages divider, Jump to Latest short and far, history paging, tool
  group/Show More expand and collapse mid-list and at the end, header
  backdrop, scroll restore after process death, Reduce Motion, light and dark.
- Frame-by-frame audit (transcript-audit) against 0.7.0, including 0.25x
  slow-motion plots of collapse and Jump to Latest.
- Dan tested each round on a Galaxy S24 Ultra (120 Hz) with an R8 build.
Tarquinen added a commit that referenced this pull request Nov 14, 2026
The transcript list was a port of iOS's UIKit TranscriptListViewController: a
top-anchored LazyColumn with ~6,000 lines of custom motion on top (a bottom
follower, jump glides, row growth from one pixel, growth rides, row entrances)
plus a snapshot flight from the composer into the list on every send. That
motion fought LazyColumn's own layout, and sending felt unlike any Android
texting app. The list's motion is now Android-native on purpose; behaviour,
flows and copy still follow iOS (noted in AGENTS.md and docs/parity).

The list
- LazyColumn(reverseLayout = true), newest row at index 0, so new and growing
  rows (a streaming reply) push older content up at the end with no follower.
- New rows at the end: requestScrollToItem(0) however many arrive at once (a
  steer that brings several rows lands above the composer), and up to three
  animate in with AnimatedVisibility (expandVertically + fadeIn) on the M3 fast
  spatial spring.
- A growing row (a streaming reply) moves its height with animateContentSize on
  a 0.22 s spring, so older rows glide up rather than step by each chunk.
- TranscriptListScroller holds the list's own scrolls: Jump to Latest (cut to a
  screen above the end when far, then one glide on M3 standard easing, 0.35 to
  0.55 s by distance), the borrowed drag, scroll to top, the New messages
  landing, and holding a toggled row in place mid-list (it grows upward at the
  end so the opened tools stay above the composer).
- Disclosures (tool groups, inner tool rows, reasoning, Show More) move their
  height on one disclosure spring; a closing body takes its gap with it.
  Rows use a flat press tint instead of the ripple, and tool headers are one
  line with the glyph on the first line.
- Rebuilt on the new list: reply selection and its autoscroll (reversed), the
  drawer's selection-handle exclusion (#57), New messages decide/fit/passed/
  read and the divider glow, FirstContentFrameRendered, scroll restore by row
  key after process death, earlier-history paging, header backdrop, Jump to
  Latest visibility, the image viewport, link previews, the agent reveal, the
  empty loading mark, TalkBack coalescing and the timeline gate.

The send
- No flight. The composer card resets in one motion: a picture of the old
  content fades out while animateContentSize(alignment = BottomStart) slides
  the top edge down on the same spring; the sent photos are decoded before the
  bubble's first frame. The list's bottom padding reads the composer height
  while measuring, so the list end moves with the card.

Deleted
- TranscriptListController, TranscriptRowGrowth, TranscriptRowEntrance,
  TranscriptScrollSprings, TranscriptScrollBehavior, TranscriptMotionTrace,
  NewDividerMotion, SessionSendFlight, SendLift, SentImageFlight, SendLanding,
  ComposerSendTransition (its swipe input moves to ComposerFieldLink), the
  composer's shrink-on-send, image/link-preview row growth, and the tuning
  knobs that only served them.
- Ported tests for that motion (TranscriptScrollBehaviorTests,
  TranscriptRowGrowthTests, TranscriptGestureReleaseTests, SentImageFlightTests,
  ComposerSendTransitionTests and individual growth/hand-off tests); each is
  listed as dropped in docs/parity.

78 files, +1,497 / -8,847 vs dev.

Verified
- scripts/check.sh (all modules) on the VM: build, lint and unit tests pass.
- Emulator with session-lab: button, IME and Ctrl+Enter sends, steer, Queue,
  failed send then Retry, a new session's first message, streaming, keyboard
  open/close, selection (a leading-edge handle drag doesn't open the drawer),
  New messages divider, Jump to Latest short and far, history paging, tool
  group/Show More expand and collapse mid-list and at the end, header
  backdrop, scroll restore after process death, Reduce Motion, light and dark.
- Frame-by-frame audit (transcript-audit) against 0.7.0, including 0.25x
  slow-motion plots of collapse and Jump to Latest.
- Dan tested each round on a Galaxy S24 Ultra (120 Hz) with an R8 build.
Tarquinen added a commit that referenced this pull request Nov 14, 2026
The transcript list was a port of iOS's UIKit TranscriptListViewController: a
top-anchored LazyColumn with ~6,000 lines of custom motion on top (a bottom
follower, jump glides, row growth from one pixel, growth rides, row entrances)
plus a snapshot flight from the composer into the list on every send. That
motion fought LazyColumn's own layout, and sending felt unlike any Android
texting app. The list's motion is now Android-native on purpose; behaviour,
flows and copy still follow iOS (noted in AGENTS.md and docs/parity).

The list
- LazyColumn(reverseLayout = true), newest row at index 0, so new and growing
  rows (a streaming reply) push older content up at the end with no follower.
- New rows at the end: requestScrollToItem(0) however many arrive at once (a
  steer that brings several rows lands above the composer), and up to three
  animate in with AnimatedVisibility (expandVertically + fadeIn) on the M3 fast
  spatial spring.
- A growing row (a streaming reply) moves its height with animateContentSize on
  a 0.22 s spring, so older rows glide up rather than step by each chunk.
- TranscriptListScroller holds the list's own scrolls: Jump to Latest (cut to a
  screen above the end when far, then one glide on M3 standard easing, 0.35 to
  0.55 s by distance), the borrowed drag, scroll to top, the New messages
  landing, and holding a toggled row in place mid-list (it grows upward at the
  end so the opened tools stay above the composer).
- Disclosures (tool groups, inner tool rows, reasoning, Show More) move their
  height on one disclosure spring; a closing body takes its gap with it.
  Rows use a flat press tint instead of the ripple, and tool headers are one
  line with the glyph on the first line.
- Rebuilt on the new list: reply selection and its autoscroll (reversed), the
  drawer's selection-handle exclusion (#57), New messages decide/fit/passed/
  read and the divider glow, FirstContentFrameRendered, scroll restore by row
  key after process death, earlier-history paging, header backdrop, Jump to
  Latest visibility, the image viewport, link previews, the agent reveal, the
  empty loading mark, TalkBack coalescing and the timeline gate.

The send
- No flight. The composer card resets in one motion: a picture of the old
  content fades out while animateContentSize(alignment = BottomStart) slides
  the top edge down on the same spring; the sent photos are decoded before the
  bubble's first frame. The list's bottom padding reads the composer height
  while measuring, so the list end moves with the card.

Deleted
- TranscriptListController, TranscriptRowGrowth, TranscriptRowEntrance,
  TranscriptScrollSprings, TranscriptScrollBehavior, TranscriptMotionTrace,
  NewDividerMotion, SessionSendFlight, SendLift, SentImageFlight, SendLanding,
  ComposerSendTransition (its swipe input moves to ComposerFieldLink), the
  composer's shrink-on-send, image/link-preview row growth, and the tuning
  knobs that only served them.
- Ported tests for that motion (TranscriptScrollBehaviorTests,
  TranscriptRowGrowthTests, TranscriptGestureReleaseTests, SentImageFlightTests,
  ComposerSendTransitionTests and individual growth/hand-off tests); each is
  listed as dropped in docs/parity.

78 files, +1,497 / -8,847 vs dev.

Verified
- scripts/check.sh (all modules) on the VM: build, lint and unit tests pass.
- Emulator with session-lab: button, IME and Ctrl+Enter sends, steer, Queue,
  failed send then Retry, a new session's first message, streaming, keyboard
  open/close, selection (a leading-edge handle drag doesn't open the drawer),
  New messages divider, Jump to Latest short and far, history paging, tool
  group/Show More expand and collapse mid-list and at the end, header
  backdrop, scroll restore after process death, Reduce Motion, light and dark.
- Frame-by-frame audit (transcript-audit) against 0.7.0, including 0.25x
  slow-motion plots of collapse and Jump to Latest.
- Dan tested each round on a Galaxy S24 Ultra (120 Hz) with an R8 build.

This branch was previously deployed

1 inactive deployment
release — 8692c4a5 Deployed Nov 12, 2026 by Tarquinen via check #177
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.

1 participant