2.7 KiB
Unfocused chat paste
Text paste routes to the active visible chat composer from transcript/background chrome. Native Cmd/Ctrl+V uses a single controlled Clipboard read when that composer is unfocused. Web uses the browser paste event without another clipboard read. Focused active composers retain native text insertion; another Flutter search/rename editor or external DOM editor retains its own paste. A stale inactive composer cannot swallow active-pane paste.
Routing combines Flutter focus ownership with DOM composed-path and open-shadow-root checks. Engine shared flt-text-editing elements and accessibility-mode inputs directly owned by flt-semantics remain eligible for the Flutter ownership check. Opaque external custom-element/iframe focus is conservatively left native. File/image paste follows the existing web attachment path, including focused accessibility-mode composers. Native file clipboard remains unsupported as before.
Verification:
- 22 focused VM tests passed under
tool/memwatch/full.sh 'test/features/chat/conversation/chat_unfocused_paste_routing_test.dart test/features/chat/conversation/chat_composer_paste_test.dart test/features/chat/domain/chat_clipboard_paste_test.dart',/tmp/memwatch/out.6cFRrZ. Real composer wiring exercises Cmd/Ctrl+V, another editor, focused active composer exactly once, inactive focused composer and file/text acceptance. Clipboard is mocked through the platform channel; no host clipboard access. - 7 Chrome tests passed under
tool/memwatch/full.sh 'test/features/chat/domain/chat_clipboard_paste_web_test.dart --platform chrome',/tmp/memwatch/out.RK4wSb. Real synthetic ClipboardEvent/DataTransfer covers text/files/images, external textarea, open and closed shadows, Flutter eligibility and capture ordering, and unclassed semantics editor files. tool/analyze.shclean:flutter-analyze.4A4P1A;git diff --checkclean. Fixture web release build succeeded usingtool/search_selection_probe_entry.dart.- Full app browser fixture evidence:
/tmp/review/unfocused-paste-final/and/tmp/unfocused-paste-capture.json. Uses in-process fixtures, synthetic events and private Chrome only. Synthetic paste validates routing/default-prevention; it does not claim trusted OS clipboard integration or native-device verification.
Harness limitation: importing full app widget dependencies into Flutter's Chrome test runner collides with SDK host.dart.js naming and hangs at loading. That attempt was interrupted and is not counted as passing. Browser bridge tests and a release-mode full app fixture avoid that test-server issue. No real chats or device clipboard were used. Work preserved for pipeline continuation; no commit, deployment or shared-service restart performed here.