native icon indicating copy to clipboard operation
native copied to clipboard

Single-line inputs strip pasted line breaks and never paint a second line

Open ctate opened this issue 4 months ago • 1 comments

Fixes the reported issue: pasting content containing line breaks into a single-line input displayed multiple lines — with the extra line painting outside the field's border.

Two independent layers:

  • Sanitize at the edit seam. Single-line kinds (input, text field, search field, combobox) strip \r/\n from inserted text per the WHATWG value-sanitization rule for single-line inputs (Chromium's paste behavior; documented with citations at the sanitize site). The rule sits in the v0.5.2 edit-derivation choke point with the order derive → sanitize → stamp → apply, so the retained editor, the core's on_input mirror (both tiers), and replay all hear byte-identical bytes — covering clipboard paste, context-menu paste, typed/automation text_input, IME composition (sanitized at preview so a commit can never land a break), and direct runtime writes, with the app-side fallback derivation applying the identical rule. An insert that strips to nothing is suppressed (pasting bare newlines never eats a live selection), and Enter-in-input is pinned as not-an-insert even against hosts that stuff a newline into the key event. Textareas are untouched.
  • Defensive render containment. Independent of sanitization, a single-line field whose value holds a break (a model-set value can — legitimately, from a Zig core) presents \n/\r as spaces byte-for-byte, so caret/selection/composition/hit-test offsets address the raw value unchanged while layout produces exactly one line on the GPU engine, the reference renderer, and packet hosts; the content-rect clip is additionally forced whenever the raw value holds a break. Copy, semantics, and automation still report the raw value.

Replay needed no journal changes — sanitization is deterministic derivation over the recorded raw events, pinned by extending the reference recording with a textarea→search-field multi-line paste.

Tests across events/ui/clipboard/text/session suites, all sabotage-verified (disabling the rule fails 10+ tests; disabling presentation or the forced clip fails the containment pins). Full battery, validate, tooling, examples, ts-core e2e all green.

ctate avatar Jul 17 '26 06:07 ctate

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
native-sdk Ready Ready Preview, Comment Jul 17, 2026 7:57am

vercel[bot] avatar Jul 17 '26 06:07 vercel[bot]