Repository navigation
Conversation
Shift+Enter at the very end of the draft moves the caret onto a line Chromium gives no line box under `white-space: pre-wrap`: the editor stays one line short of the caret and, at the 10-row cap, nothing can scroll toward a line with no box — the caret sits out of sight until the next typed character turns it into content. The same boxless line is what a restored draft ending in "\n" parks its caret on. Fix the shared root in the shell, not the editor library: - `white-space: break-spaces` on the editable (renderer styles) gives every preserved break a real line box, so the box grows immediately and the tail becomes scrollable. `!important` because Astryx ships pre-wrap through a stylex utility at (3,1,0) specificity that no plain Maka selector beats. - `revealTailLineBreak` (composer.tsx) scrolls the editor to the tail after `insertLineBreak` when the caret ends the draft — deterministic at the cap, a no-op while the content fits. Wired into the Shift/Alt+Enter path and the multi-line insert replay, so a paste ending in a newline reveals its tail too. Fixes apache#5811 Generated-by: GLM-5.3-Flash (ZCode)
Astro-Han
left a comment
There was a problem hiding this comment.
Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.
Reviewed 38cfbcf against main 59f61cf, including all three changed files. The CSS changes whitespace handling, and Composer now conditionally scrolls after inserting a line break. Two P2 issues remain, detailed inline: the real tail-caret shape bypasses the reveal at the row cap, and the editable-only whitespace override breaks the existing next-prompt Storybook contract/CI.
Using the production WorkHub/Composer Storybook and real Chromium, I typed a 14-line draft, moved to its end and pressed Shift+Enter. The scroll height grew from 316 to 338 px with a 220 px viewport, but scrollTop stayed 96 rather than reaching 118. The new predicate saw a connected newline text node at offset zero and returned without scrolling. A deferred-scroll control reaches 118. A separate restored-text input reproduces the same failure.
The production next-prompt story fails in all four 1280/720 px × light/dark cases. Restoring only the previous whitespace value makes all four plays pass, matching the exact-head CI failure. This failure is attributable to this PR.
Fresh dependencies/patches, the normal clean test build, renderer and Storybook builds, all 781 UI tests, six shell-layout tests, lint/ASF/whitespace checks passed. The five new unit tests pass, while replacing only Composer with actual main makes four fail; their mocked caret does not cover the newline text-node shape observed in Chromium. The static merge with current main is clean. AI declaration and Generated-by are present. No protocol or database change is involved. I did not run native Electron or platform IME sessions.
A real Shift+Enter at the very end of the draft does not leave a `<br>` after the caret: under `white-space: break-spaces` Chromium parks the inserted break as a literal `\n` text node and the collapsed selection at its offset 0. `caretAtContentEnd` read any remainder inside the caret's own text node as content still to come and returned false, so `revealTailLineBreak` skipped the scroll — measured in real Chromium (Storybook's WorkHub composer), a 14-line draft at the 220px cap grew scrollHeight 316 to 338 while `scrollTop` stayed parked at its pre-break offset (89-96 across runs) instead of the required 118, leaving the new tail line outside the scrollport. Treat a `\n`-only remainder like the trailing `<br>` it replaces: the caret ahead of it still ends the draft. A newline followed by any other character keeps the caret mid-draft and never scrolls. Verified in headless Chromium against the built Storybook (product-workhub--standard-composer): with this change the same keystrokes land `scrollTop` 118 = scrollHeight 338 - clientHeight 220, and the recorded selection shape is TEXT_NODE `"\n"` at offset 0 both before and after. Unit tests cover the shape and its mid-draft negative. Generated-by: GLM-5.3-Flash (ZCode)
…itable apache#5811 gave the composer editable `white-space: break-spaces` so a trailing line break gets a line box, but the next-prompt suggestion — which overlays the same grid cell precisely so a wrapping suggestion reserves the same height as the accepted draft — still measured text with `pre-wrap`. The two wrapped trailing whitespace differently, and the NextPromptSuggestion story's play, which asserts the editor's metrics equal the offered suggestion's (client rects, font, letterSpacing, whiteSpace, wordBreak), failed in all four renders (light/dark x 1280/720). Sync the mirror to break-spaces: the editable's value is the contract, and the suggestion reserves height by matching it. Verified with the production render smoke's own harness on the built Storybook: `product-workhub--next-prompt-suggestion` passes all four jobs with this change and fails with `pre-wrap` restored (`metrics(input)` no longer deep-equals the offered metrics). Generated-by: GLM-5.3-Flash (ZCode)
Astro-Han
left a comment
There was a problem hiding this comment.
Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.
Reviewed 5bb8257d4f781760fcfb8dfd12907e3f17a866b3, including both follow-up commits (three-file increment, +35/-4) after 38cfbcfb. Both previous P2 findings are fixed: a trailing newline text node now counts as the caret's tail, and the next-prompt overlay uses the editable's break-spaces whitespace contract. I found no new confirmed P0–P2 issue.
Using the actual WorkHub/Composer Storybook in Chromium, all four next-prompt plays passed (1280/720 px × light/dark, with the actual viewport width asserted). Eight capped-draft checks passed across keyboard-built and multiline-filled drafts: after Shift+Enter, the 220 px editor's scroll height grows from 316 to 338 px and scrollTop moves from 96 to 118, exposing the new tail line. A short draft grows from 30 to 52 px, and a mid-draft break does not jump to the tail. I inspected the 720 px dark capture.
The controls isolate both fixes. Loading only the previous Composer makes the new trailing-newline regression fail (6 pass, 1 fail). Restoring only the overlay's old pre-wrap rule makes all four real next-prompt plays fail their original metrics comparison; the editor remains break-spaces while the offered overlay is pre-wrap. These controls change only loaded test modules or browser-served CSS, not source files.
The normal clean root test build, production renderer and Storybook builds, all 803 shared-UI tests, six shell-layout tests, changed-file lint, ASF headers and git diff --check passed. Compiled UI test files match all 96 source test files with no extra stale tests. Dependencies and patches were reused from a fresh installation with identical inputs. The static merge with current main 15d0a0dd19d39e2bc09ae35940e432c636982315 is clean and its epoch guard passes at 228; this PR makes no protocol change. Exact-head CI run 39950332742 succeeded.
I did not run native Electron, platform IME sessions or a persisted-draft restoration flow. The multiline-filled browser cases exercise editor content, not a real stored-draft reload. The documented choice to open long restored drafts at the top remains; this fix does not add automatic restore-to-caret scrolling.
|
This pull request has had no new commits for 30 days and has been marked stale. It will be closed in 7 days unless a new commit is pushed. Comments do not reset this timer: only a new commit does. If the pull request is intentionally long-lived, a maintainer can apply the |
|
Rebase & full-chain verification refresh (2026-11-25) Context: upstream Rebased onto
Attribution: original fix by @ggbdpq; rebase & verification refresh by GLM-5.3-Flash (ZCode). |
Summary
Shift+Enter with the caret at the very end of the draft inserts the break but the composer neither grows nor scrolls: under the editor's
white-space: pre-wrap, Chromium'sinsertLineBreakparks the caret on a line that gets no line box, so at the 10-row cap nothing can scroll toward a line with no box — the caret sits out of sight until the next typed character. A restored draft ending in\nparks its caret on the same boxless line.Fix both shapes at the shared root, in the shell (no dependency patch):
white-space: break-spaceson the composer editable gives every preserved break a real line box, so the box grows immediately and the tail becomes scrollable.!importantis required: Astryx ships itspre-wrapthrough a stylex utility at (3,1,0) specificity that no plain Maka selector beats.revealTailLineBreakin the Composer scrolls the editor to the tail afterinsertLineBreakwhen the caret ends the draft — deterministic at the cap, a no-op while the content fits. Wired into the Shift/Alt+Enter path and the multi-line insert replay, so a paste ending in a newline reveals its tail. Mid-draft breaks never scroll; the browser already reveals those.One residual left as-is on purpose: restoring a long draft that ends in
\nnow gets a real tail line (geometry fixed), but the editor still opens at the top rather than auto-scrolling to the end-of-draft caret — scrolling a restore to its tail felt like the wrong default. Happy to add it if maintainers prefer restore-to-caret.Fixes #5811
Verification
composer-tail-line-break.test.tsx)AssertionError: 0 !== 220on the four tail scenarios), green after (5/5) — re-verified independently against the builtdistboth ways@maka/uifull suiteshell-layout-widths.test.mjs(readscomposer.css)biome check --linter-enabled=trueon touched filesnpm run check:asf-headersscrollTop/scrollHeightassertion)AI use
Implemented by GLM-5.3-Flash (ZCode). Root cause verified against the installed
@astryxdesign/core0.6.3 dist (no auto-resize/scroll logic in the library; the editable is capped by an inlinemaxHeight), and the red/green runs above were re-executed independently before opening this PR.Checklist