Chat links: a mouse click opens the link even when the pointer drifts
The selection area claimed a primary mouse press on a link as a selection drag once the pointer moved 2 px, so in the browser ordinary clicks with a little hand or trackpad movement opened nothing. A link's recognizer now accepts a primary mouse press on pointer down, as an anchor does; the click still cancels past the tap slop, drags from plain text still select across links, and touch long press keeps Copy link.
This commit is contained in:
@@ -13,6 +13,16 @@
|
||||
links outside backtick code become links. Text without a link stays
|
||||
`SelectableText`.
|
||||
- Inline code and fenced code are never linkified.
|
||||
- Click: a primary mouse press on a link belongs to the link (its recognizer
|
||||
accepts on pointer down), like a press on a web page's anchor. Before, the
|
||||
`SelectionArea` claimed the press as a selection drag once the pointer moved
|
||||
`kPrecisePointerPanSlop` (2 px), so in the browser a click with a little
|
||||
hand or trackpad drift opened nothing (headless Chrome: 0-2 px opened, 3, 5
|
||||
and 8 px did not). The click still cancels past the tap slop (18 px); a
|
||||
selection drag that starts on plain text still crosses links; a drag that
|
||||
starts on a link selects nothing (as a browser drags an anchor). Touch,
|
||||
stylus and right-click presses keep competing in the arena, so a long press
|
||||
still selects and offers Copy link.
|
||||
- Style: host primary colour (`CupertinoTheme.primaryColor`), underline; hover
|
||||
thickens the underline (paint-only, selection survives) with a click cursor.
|
||||
- Copy link: long press adds it to the selection toolbar. On native desktop the
|
||||
@@ -23,6 +33,17 @@
|
||||
rebuilds without its platform menu wrapper, remounts its subtree, throws in
|
||||
`StaticSelectionContainerDelegate.hasSize` and drops the selection.
|
||||
|
||||
Browser check: `tool/capture/examples/chat-link-click.json` drifts a click
|
||||
5 px on a link and drags a selection across links, and expects exactly one
|
||||
`window.open`. Checked in headless Chrome (Nov 2026), desktop and touch
|
||||
emulation (iPhone/Android/iPad user agents): tap and click open through
|
||||
`window.open` with user activation active; right-click Copy link (desktop)
|
||||
and long-press Copy link (touch) write the URL to `navigator.clipboard` and it
|
||||
reads back. Not verified: real iOS/macOS Safari (popup and clipboard user
|
||||
activation rules differ) and real devices. In headless CPU rendering the
|
||||
text-selection toolbars (stock Copy/Select all as well as Copy link) draw no
|
||||
surface; popup menus do, so this looks like the renderer, not the links.
|
||||
|
||||
Browser capture: `?links=1` on the chat fixture (`tool/perf/chat_scroll_fixture.dart`).
|
||||
With the capture kit's semantics tree on, a CDP click lands on link semantics
|
||||
nodes whose rects are the bounding box of a wrapped link, so verify clicks with
|
||||
|
||||
Reference in New Issue
Block a user