Redesign selection handles (teardrop + 48dp grab); place menu above selection

- Handles are now teardrops (stem + filled circle) like the native
  Android selector: 20dp circle normally, 28dp while dragging.
- The grab region is a 48dp box around the circle centre, independent
  of the visual size; the old 16dp target was not grabbable by finger.
- The copy/cut/paste menu is placed ABOVE the selected line (native
  behaviour), flipping below only when there is no room above. The menu
  is drawn last (top of the z-order) and Gio routes a touch to the
  topmost op whose clip contains it, so a below-placed menu covered the
  handles' grab boxes and silently stole every handle-drag press.
- Regressions: menu above-placement arithmetic, first-line flip-below,
  and the existing tracking/clamp tests updated for the new policy.
- On-device verified: handle drags work with the menu up (previously
  dead lower grab region), first-line handles still grabbable from the
  uncovered top strip, menu taps and tap-to-clear unchanged.
- doc/development_plan.md section 15 records the z-order/placement
  contract.
This commit is contained in:
gmp
2026-08-18 08:08:51 -04:00
parent dcb96d04d8
commit dc35aa2e36
4 changed files with 150 additions and 28 deletions
+28
View File
@@ -906,3 +906,31 @@ status bar and clickable; bottom bar flush with the keyboard top (view
spans 128..1517 with the IME shown); BACK dismisses the keyboard and
re-tap re-raises it without a re-show loop; typing saves; the selection
menu tracks small scrolls and hides when the word leaves the viewport.
## 15. Selection handles: teardrop shape, grab box, and menu placement (2026-08-18)
**Handles.** The selection/caret handles are teardrops (a stem from the
caret point to a filled circle, like the native Android selector). The
circle is 20dp normal and 28dp while its drag is active. The GRAB region
is deliberately much larger than the visual: a 48dp box centred on the
circle centre. The visual size and the touch target are independent —
small visuals with 48dp targets is the native behaviour, and the earlier
16dp target was not grabbable by finger.
**Menu placement contract: above first, below on overflow.** The
copy/cut/paste menu is placed ABOVE the selected line (like the native
Android selection toolbar), flipping below only when there is no room
above the window, and clamped to the window edges. This is not a matter
of taste: the handles hang off the line's BOTTOM edge, and the menu is
drawn last, so it sits on top of the z-order — Gio routes a touch to the
topmost op whose clip contains it. A menu placed below the line therefore
covers the handles' grab boxes and silently steals every touch meant for
a handle drag (a drag can only grab once it has received the PRESS; a
press captured by the menu's click never reaches the drag, no matter how
far the finger then moves). Verified on device: with the menu up, drags
from the previously-dead lower grab region work once the menu is above;
in the first-line case (menu flipped below) the handles are still
grabbable from the uncovered top strip of their boxes.
Regressions: `internal/editor/selection_menu_track_test.go` (tracking +
above-placement arithmetic + first-line flip).