Repository navigation
fix(desktop): wipe the composer's stale pixels when it empties - #819
Merged
Merged
Conversation
After sending a message the composer sometimes kept the last line of it painted: the DOM was empty (the placeholder hint was up, the caret sat at line one), yet the sent line stayed on screen — reported with a screenshot on macOS 26. What the screenshot shows, once the pixels are measured: the previous first line is gone exactly where the placeholder hint's box was, and the previous second line survives exactly in its own glyph box (x 177–1275, the same width as that line in the message bubble above). So the clear's own repaint never reached the editor, while the hint's mount did get repainted. WKWebView presents partially updated frames on macOS 26 (wry#1848: "some regions from the new frame, some from the old one" — DOM and hit-testing live), which is the same family the hover-controls workaround in MessageBlock already documents. The hint is the one element whose mount is guaranteed to accompany a clear, so widen it from the text's own box (left-2 top-1) to the editor's whole box (inset-0 plus the editor's padding, leaving the text where a typed first line would sit). Its mount then dirties every pixel of the editor, and the repaint that follows wipes whatever the clear left behind; its unmount does the same when a draft is restored. Verified in the headless harness: the hint's box now equals the editor's box and its text line is unchanged (417,748,336.2×17 — identical before and after), a 2× capture of the whole composer card is pixel-identical to the previous build (0 of 2,291,520 pixels differ), and hit-testing still reaches the editor through the hint (elementFromPoint → role=textbox, click focuses it).
Measure the reporter's screenshot (ink-colour bands, glyph boxes, the hint's rect vs. the leftover line) and record what was and was not validated, so the "do not shrink the hint / do not composite the editor" constraints in MentionEditor.tsx have their evidence next to them. Notes that the defect is a WKWebView presentation issue on macOS 26 (wry#1848), not app state: the DOM was empty and the hint up while the pixels showed the sent line.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Symptom
A message sent from the desktop composer (macOS 26/WKWebView) sometimes stays painted: the input box keeps the last line of the message that was just sent, with the empty-state hint drawn above it. Screenshot from the report attached below; the sent prompt was two lines and contained a
/skillmention.Diagnosis
The app state was already correct — that is what made this look like a clear-path bug but it is not:
{empty ? …}, over theemptystate a MutationObserver keeps in sync), and it was up.So the editor's DOM was empty, the hint's mount repainted its own rect, and the clear's own repaint never reached the editor. That is WKWebView on macOS 26 presenting a partially updated frame — regions of the new frame next to regions of the old, DOM and hit-testing live (tauri-apps/wry#1848) — the same family
MessageBlock'swill-changenote already works around.Fix
The empty-state hint now covers the editor's whole box (
inset-0plus the editor's ownpx-2 py-1) instead of just the text's own width (left-2 top-1). Mounting it — which always accompanies a clear — dirties every pixel of the box, so the repaint that follows wipes whatever the clear left painted; unmounting it does the same when a draft is restored. The padding keeps the hint's text exactly where a typed first line would sit, and it stayspointer-events-nonenow that it overlays the editor.Also pins both constraints in a comment (and in the verification note,
docs/archives/verification/composer-stale-line-20260924.md): don't shrink the hint back to the text's width, and don't give the editor a compositor layer of its own — a promoted editor stops painting into the hint's layer, which is what makes the repair work.Verification
npx tsc --noEmit,npx eslint(wholedesktop/src+shot+ config),npx vitest run— 144 files / 1252 tests pass, including a new assertion on the hint's geometry contract.409,743, 750×56) and its text line is unchanged (417,748, 336.2×17); a 2× capture of the whole composer card is pixel-identical to the previous build (0 of 2,291,520 pixels differ);elementFromPointat the bottom of the box still returnsrole=textboxand a click focuses the editor.Not validated
No native WKWebView reproduction was possible from here, so this rests on the presentation defect being region-local and on the hint's mount dirtying the editor's box — which the screenshot shows working for the smaller rect, not for the whole box. If a ghost recurs in a path where the hint does not mount or unmount (a restore that replaces text with text), the next lever is a compositor promotion of the editor, paired with dirtying the editor's own layer. The verification note records that gap.