Skip to content

fix(ui): composer jitters when a draft reaches its height cap in Safari - #186232

Merged
jalehman merged 3 commits into
mainfrom
fix/composer-gutter-oscillation
Oct 27, 2026
Merged

jalehman merged 3 commits into
mainfrom
fix/composer-gutter-oscillation

Conversation

@jalehman

@jalehman jalehman commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: the chat composer jitters (text rewraps and the page bounces every frame) when a draft reaches the composer's maximum height in Safari, iOS, and other overlay-scrollbar browsers.

User Impact

User impact: typing or deleting across the composer's height cap is steady again on iOS and desktop Safari; the text width no longer changes when the draft starts scrolling.

Why This Change Was Made

#185199 swaps 8px of end padding for a scrollbar-gutter: stable gutter once a draft overflows. Chromium reserves that gutter, but WebKit reserves it only while a scrollbar is actually shown, and overlay scrollbars (iOS, Android) reserve nothing. Near the cap the swap therefore widens the text by 8px, the draft fits again, the swap is undone, the text narrows, it overflows again, and the composer's ResizeObserver repeats the cycle every frame.

The composer now forces a real scrollbar (overflow-y: scroll) while it reserves the gutter, measures the scrollbar width once per textarea, and keeps the plain padding (no swap) where that width is zero. Short drafts keep the #185199 fast path.

Evidence

Six consecutive captures of the real composer in Playwright WebKit with a draft at the cap. Before: the last line alternates between two layouts. After: identical frames.

Composer at the height cap: before alternates, after is stable

  • New chat-composer-overflow.browser.test.tsx case finds the drafts that overflow only until the 8px swap widens the text, asserts such drafts exist (so a font or layout change cannot make it pass vacuously), and types across them, asserting data-composer-scrollable stops toggling. Overlay (zero-width) bars run in both engines; classic bars run in WebKit only, since Chromium reserves the stable gutter.
    • origin/main: fails in WebKit (classic + overlay) and Chromium (overlay).
    • This PR: passes in all three (WebKit ~2.6s first case incl. warm-up + 0.8s, Chromium ~0.9s).
  • chat-composer-overflow and chat-composer-mobile browser files pass in WebKit and Chromium; chat-composer-sizing, chat-mobile-scroll-fades, new-session/composer unit tests pass; composer-text-readability.e2e passes (its overflow assertion now accepts scroll).
  • pnpm tsgo:ui, oxlint on touched files, pnpm format:check, git diff --check clean.
  • Gap: not run on a physical iOS device; the overlay case is covered by a zero-width-scrollbar emulation in both engines.

@clawsweeper

clawsweeper Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@jalehman
jalehman marked this pull request as ready for review October 27, 2026 19:12
@jalehman
jalehman enabled auto-merge (squash) October 27, 2026 19:16
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 27, 2026
@clawsweeper

clawsweeper Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR keeps composer text width stable when a draft reaches its height cap in WebKit and overlay-scrollbar browsers.

Example: A multiline draft reaches the height cap in a 342px-wide composer.

  • Before: Trading 8px of padding for a missing scrollbar gutter repeatedly changes line wrapping.
  • After: Classic scrollbars receive a forced gutter, while zero-width scrollbars retain the padding.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, focused repair supported by directly inspected visual evidence and reported regression coverage, with broad CI still pending.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after captures exercise the real rendered composer in Playwright WebKit at its height cap and show stable wrapping after the shared sizing repair; the body also reports base failures and head passes in WebKit and Chromium for classic and zero-width scrollbars, while explicitly excluding physical iOS verification.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Typing near the composer height cap makes text repeatedly rewrap and the page bounce in affected browsers.
Reason: The demonstrated editing regression warrants a narrow correction, and the maintainer-authored direction preserves the earlier performance goal.

Regression provenance

Regression provenance — verified: source commit e5aa4489f728 by Peter Steinberger; canonical PR #185199 (blame-to-merge-commit).

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it addresses a demonstrated composer regression still present on main, with a focused repair and no actionable correctness findings; CI remains pending.

Priority: P2
Reviewed head: 007ef70f47e30fecdf14f63ed51bb6cb88b9f5bc

Before merge

None.

Findings

None.

Agent review details

How this fits together

The shared Control UI textarea owner receives input and resize events, measures overflow, and updates scrollbar, height, and fade presentation for Chat, New Session, and answer fields.

flowchart TD
  A[Draft input] --> B[Shared textarea owner]
  C[Resize observer] --> B
  B --> D[Overflow measurement]
  D --> E[Scrollbar and padding selection]
  E --> F[Stable composer layout]
Loading

Technical review

Best possible solution:

Keep the repair in the existing textarea owner, preserving equal text width across overflow transitions without restoring short-draft gutter overhead.

Do we have a high-confidence way to reproduce the issue?

Current-main overflow and padding logic establishes the feedback loop, and the supplied WebKit captures show it visibly; this read-only review ran no target code.

Is this the best way to solve the issue?

The patch repairs the width invariant at its existing owner, preserves native sizing and short-draft behavior, and adds focused coverage for the two scrollbar modes.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 364c0d4ebcd4.

Provenance checked

  • Conditional composer gutter keeps the original intent (e5aa448: Avoid native gutter layout overhead for short drafts while preserving text alignment and long-draft scrolling.)
  • Native sizing and deferred overflow keeps the original intent (d51f360: Keep typing responsive by using native content sizing and deferring geometry reads beyond input handling.)
  • Readability E2E overflow assertion keeps the original intent (4274227: Consolidate test scaffolding while retaining behavioral checks; the changed assertion now permits scrolling through either auto or scroll overflow.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit e5aa448 adds ui/src/pages/chat/components/chat-composer-dom.ts:230 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e5aa4489f728; files: ui/src/pages/chat/components/chat-composer-dom.ts)
  • Josh Lehman: Raw commit 7115c4b adds ui/src/pages/chat/components/chat-composer-dom.ts:20 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7115c4b6fccf; files: ui/src/pages/chat/components/chat-composer-dom.ts)
  • Marvinthebored: Raw commit d51f360 adds ui/src/pages/chat/components/chat-composer-dom.ts:23 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d51f3607b978; files: ui/src/pages/chat/components/chat-composer-dom.ts)

PR surface

Source +31, Tests +51. Total +82 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 37 6 +31
Tests 2 52 1 +51
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 89 7 +82

Labels

Label changes:

  • add P2: Repeated composer rewrapping disrupts drafting on affected browsers, with a bounded repair in shared UI sizing.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Repeated composer rewrapping disrupts drafting on affected browsers, with a bounded repair in shared UI sizing.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 27, 2026, 3:28 PM ET / 19:28 UTC.

@jalehman
jalehman merged commit ca9ee27 into main Oct 27, 2026
75 of 78 checks passed
@jalehman
jalehman deleted the fix/composer-gutter-oscillation branch October 27, 2026 22:04
@jalehman

Copy link
Copy Markdown
Contributor Author

Merged via squash auto-merge.

steipete added a commit that referenced this pull request Oct 28, 2026
…t e2e (#186409)

ui/src/e2e/new-session-page.prompt-attachments.e2e.test.ts failed 10/10 on main: it expected the composer prompt overflow to be `auto`, but #186232 (ca9ee27, Safari jitter at the draft height cap) intentionally keeps classic scrollbars (`scroll`) to prevent height oscillation and updated its own tests, missing this one.

The stale assertion now expects the intended `scroll`; the test's geometry and interaction assertions are unchanged. Native bisect identified ca9ee27 as the introducing commit. Production LOC 0, test-line delta 0. The file passes 11/11 locally and on AWS; exact-head CI green; full UI e2e failures reproduce on pinned main; autoreview clean through P2.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 28, 2026
…ri (openclaw#186232)

* fix(ui): stop composer jitter when drafts reach the height cap

* test(ui): pin composer cap test to its unstable drafts
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 28, 2026
…t e2e (openclaw#186409)

ui/src/e2e/new-session-page.prompt-attachments.e2e.test.ts failed 10/10 on main: it expected the composer prompt overflow to be `auto`, but openclaw#186232 (5372568, Safari jitter at the draft height cap) intentionally keeps classic scrollbars (`scroll`) to prevent height oscillation and updated its own tests, missing this one.

The stale assertion now expects the intended `scroll`; the test's geometry and interaction assertions are unchanged. Native bisect identified 5372568 as the introducing commit. Production LOC 0, test-line delta 0. The file passes 11/11 locally and on AWS; exact-head CI green; full UI e2e failures reproduce on pinned main; autoreview clean through P2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant