Skip to content

fix(ui): Control UI freezes in WebKit when a picker replaces an opening menu - #198658

Merged
fuller-stack-dev merged 5 commits into
openclaw:mainfrom
fuller-stack-dev:fix/webkit-closing-overlay-anchor-hang
Nov 14, 2026
Merged

fuller-stack-dev merged 5 commits into
openclaw:mainfrom
fuller-stack-dev:fix/webkit-closing-overlay-anchor-hang

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Related: #196820

What Problem This Solves

Fixes: the Control UI freezes in Safari and the macOS app when one menu or picker opens while another anchored menu is still opening and the layout changes. One example is opening the sidebar Agent menu, then quickly toggling Home and opening a settings picker. Scrolling still works, but nothing else responds until the app reloads.

User Impact

User impact: switching quickly between overlays in WebKit no longer freezes the Control UI. The one visible difference: an overlay that had flipped to fit the viewport may return to its default side during its 100–200 ms fade-out.

Why This Change Was Made

When a surface in an exclusive group (here the opening Agent menu) closes because another one opens, WebKit keeps re-resolving the closing surface's position-try-fallbacks and never finishes style resolution. Every later style flush hangs the page: our getAnimations() calls, and also WebKit's own rendering update. A closing surface is only fading out, so it no longer needs fallbacks. The document stylesheet (ui/src/styles/components.css) now sets position-try-fallbacks: none on any surface with data-phase="closing". It uses !important because several surfaces declare their own fallback lists with more specific selectors. It doesn't go in overlay.css, because that file is also embedded as a string in the boot JS for shadow-hosted surfaces. Adding 59 bytes there grew the compressed boot bundles by about 320 B, which failed the performance ratchet.

Chromium was unaffected. The rule applies in every engine to keep overlay behavior the same across browsers.

Evidence

  • New regression test. ui/src/e2e/overlay-menu-swap-webkit.e2e.test.ts replays the swap in Playwright WebKit through the real Control UI and mock Gateway, in the same frame the Agent menu reaches the top layer. Without the fix it fails both times with "WebKit stopped answering after the menu swap". With the fix it passes 4 of 4. It's registered in the CI webkitSuites list and in test/scripts/ci-ui-browser-dependencies.test.ts, which passes 7 of 7.
  • System WebKit (macOS 27.2, WebKit 22625.2.8.11.9, the engine the Mac app uses). A WKWebView harness ran the production Control UI build. The same sequence hung 3 of 3 before the fix and 0 of 3 after, at three timings and with both the real Home button and the Home toggle event. A randomized fuzz run (one seed, 8 tries) hung 5 of 8 before and 0 of 8 with the rule. The hung process's stack matches the user's four freeze samples: Element::getAnimations → Document::resolveStyle, with TreeResolver::resolve repeating invalidateForResumingAnchorPositionedElementResolution.
  • Existing overlay coverage.
    • Chromium browser lane (overlay anchor, overlay lifecycle, popover, overlay style, menu navigation): 113 passed.
    • WebKit browser lane (select picker, sidebar rail and Agent menus, menu surface, tooltip): 88 passed.
  • Changed-file checks. node scripts/check-changed.mjs passes. I skipped the dead-export scan, because it fails on files this branch doesn't touch (scripts/perf/transcript-facts-backfill-stress-preload.mjs, extensions/workboard/src/store-evidence.ts).
  • Bundle size. With Node 24.22.1, matching CI, pnpm ui:check-performance:base passes against main: boot JS +0 B, boot CSS gzip about +10 B, total CSS raw +59 B (allowance 64 B).
  • Review. Codex autoreview of the branch came back scoped-clean at P0.

Screenshots (Playwright WebKit, mock data):

Before: last frame painted, then frozen After: the swap completes
Agent menu open; the UI stops repainting after Home and the font picker are clicked Agent menu closed, Home panel open, UI responsive

A frozen page can't paint a new frame, so "before" shows the frame it freezes on. In "after", the font picker's menu is open below the fold after the layout shift; the test asserts that state.

Gaps

  • Shadow-root overlays. Tooltips, and menus, popovers and modal dialogs hosted inside a shadow root, don't get the rule, because it lives in the document stylesheet. Every reproduction involved light-DOM menus and pickers, and tooltips aren't in the menu exclusive group. A shadow-hosted swap could still hit the loop.
  • Not yet in the installed app. I haven't run the fix in the installed Mac app; the system-WebKit harness uses the same engine and production build.
  • Theme-switch freeze not reproduced. The issue's freeze during a theme switch fits the same pattern: a getAnimations() call from the overlay close path in a microtask. I didn't reproduce that path separately.
  • Not reported to WebKit yet. I haven't filed a WebKit bug; I don't have a reproduction without OpenClaw's own code yet.

WebKit never finished style resolution when an anchored overlay that was
still opening got closed by another overlay in its exclusive group while
the layout changed, for example opening the sidebar Agent menu, toggling
Home, then opening a settings picker. The closing surface kept retrying
its position-try fallbacks and the Control UI froze until reload.

A closing overlay is only fading out, so it now drops position-try
fallbacks. The new WebKit e2e suite replays the swap through the real
Control UI and fails on the previous stylesheet.

Refs openclaw#196820
@clawsweeper

clawsweeper Bot commented Nov 14, 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.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 14, 2026
@clawsweeper

clawsweeper Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR disables anchor-position fallbacks during overlay closing and adds a WebKit regression to CI.

Example: At 1440×900, open the Agent menu, toggle Home, and immediately open the Appearance font picker.

  • Before: WebKit can become stuck resolving the closing menu’s position, leaving the Control UI unresponsive.
  • After: The Agent menu closes and the font picker opens; a closing overlay may briefly return to its preferred side.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch is supported by production-renderer evidence and has no actionable findings; the broader linked issue is only partially addressed.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Public production-build WKWebView output exercises the Agent-menu/Home/font-picker sequence in system WebKit and records recovery from 3/3 hangs before to 0/3 afterward; inspected screenshots and browser regression output corroborate the changed light-DOM path. Installed-app, shadow-root, and separate theme-switch coverage are explicitly outside the demonstrated scope.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: Rapidly replacing an opening anchored menu during a layout change can freeze the Control UI in WebKit.
Reason: The maintainer-authored direction restores responsiveness with a small CSS change and a targeted regression; it intentionally covers only the demonstrated subset of the linked issue.

Merge readiness

✅ Ready for maintainer review

This PR provides a focused, supported fix for a reproducible WebKit freeze, and I found no introduced correctness or security defect.

Priority: P1
Reviewed head: 6e3b322a56ffbfeb3c7e5e42471e185d19853280

Before merge

None.

Findings

None.

Agent review details

How this fits together

Control UI menus and pickers share an exclusive overlay lifecycle; accepted close transitions publish a phase that CSS uses while native surfaces finish their exit animations.

flowchart TD
  A[Agent menu opens] --> B[Home changes layout]
  B --> C[Font picker opens]
  C --> D[Shared lifecycle closes Agent menu]
  D --> E[Closing CSS disables position fallbacks]
  E --> F[WebKit completes style resolution]
Loading

Technical review

Best possible solution:

Land the focused closing-phase fix while keeping the broader linked freeze report open for its unresolved scenarios.

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

The committed browser scenario and public before/after WebKit output establish a deterministic overlay-swap reproduction; this read-only review did not execute it independently.

Is this the best way to solve the issue?

Disabling fallbacks only during the existing closing phase is the smallest supported fix: it removes the demonstrated style-resolution trigger without adding state, replacing the lifecycle, or changing usable-menu placement.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 53afb9f9bfba.

Provenance checked

  • Closing overlay positioning changes intended behavior with a stated reason (feat(ui): use native Solid overlays and tabs #169128: Native overlays use one lifecycle owner and CSS anchors for placement, flip fallbacks, and viewport limits.)
  • Viewport-fit fallbacks keeps the original intent (c6fc5bd: Viewport-fit candidates prevent menus near window edges from collapsing into unreadable strips; those candidates remain enabled while menus are usable.)
  • WebKit CI dependency selection keeps the original intent (b68c44c: The existing workflow installs WebKit for the shard owning a suite that needs it; this PR extends that same registration and guard.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +9, Tests +93, Config +1. Total +103 across 4 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 1 9 0 +9
Tests 2 93 0 +93
Docs 0 0 0 0
Config 1 1 0 +1
Generated 0 0 0 0
Other 0 0 0 0
Total 4 103 0 +103

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; 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:

  • P1: The demonstrated WebKit failure freezes normal Control UI interaction until reload.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; 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.

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-14T05:08:59.984Z sha 591dc13 :: needs maintainer review before merge. :: none

Reviewed November 14, 2026, 11:47 AM ET / 16:47 UTC (Revision 2).

Select closing surfaces by data-phase alone. The rule only affects anchored elements, and the shorter selector keeps total CSS growth under the 64 B build-variance allowance.
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Raw reproduction evidence, as ClawSweeper suggested.

Playwright WebKit e2e, ui/src/e2e/overlay-menu-swap-webkit.e2e.test.ts. Baseline: overlay.css from the parent commit

AssertionError: WebKit stopped answering after the menu swap: expected 'hung' not to be 'hung' // Object.is equality
      Tests  1 failed (1)
AssertionError: WebKit stopped answering after the menu swap: expected 'hung' not to be 'hung' // Object.is equality
      Tests  1 failed (1)

Same test with the fix, on merged head 2a3e9ba

 ✓ |ui-e2e-bundled| ui/src/e2e/overlay-menu-swap-webkit.e2e.test.ts:29 > overlay menu swap in WebKit > keeps WebKit responsive when a picker replaces the opening agent menu 1710ms
     ✓ keeps WebKit responsive when a picker replaces the opening agent menu 1710ms

System WebKit (macOS 27.2, WebKit 22625.2.8.11.9) WKWebView harness, production Control UI build. Sequence: open Agent menu, then Home, then font picker in the menu's first frame

base build, real Home button: 3/3 hung
fix build, real Home button: 0/3 hung
fix build [frames=0 | frames=1 | 120 ms gap]: 0/3 | 0/3 | 0/3 hung
seed-5 fuzz, 150 s x 8: base 5/8 hung, closing-only rule 0/8

Sample of a hung base run (WebContent main thread):

1113 WebCore::jsElementPrototypeFunction_getAnimations(JSC::JSGlobalObject*, JSC::CallFrame*)  (in WebCore) + 172  [0x1bc90ee54]
1113 WebCore::Element::getAnimations(std::optional<WebCore::GetAnimationsOptions>)  (in WebCore) + 312  [0x1bc858c3c]
1113 WebCore::Document::updateStyleIfNeeded()  (in WebCore) + 352  [0x1bb8ecd24]
957 WebCore::Document::resolveStyle(WebCore::Document::ResolveStyleType)  (in WebCore) + 2148  [0x1bb912768]
880 WebCore::Style::TreeResolver::resolve()  (in WebCore) + 676  [0x1bb91317c]
367 WebCore::Style::TreeResolver::resetStyleForNonRenderedDescendants(WebCore::Element&)  (in WebCore) + 664,640,...  [0x1bb914c70,0x1bb914c58,...]
149 WebCore::Style::TreeResolver::resetStyleForNonRenderedDescendants(WebCore::Element&)  (in WebCore) + 3720  [0x1bb915860]
146 WebCore::Style::TreeResolver::resetStyleForNonRenderedDescendants(WebCore::Element&)  (in WebCore) + 3720  [0x1bb915860]

overlay.css is also embedded as a string in the boot JS for shadow-hosted surfaces, so adding to it grew the boot bundles by ~320 B gzip under the performance ratchet. Move the rule to the document stylesheet: the light-DOM menus and pickers that reproduce the WebKit hang keep the fix, and the boot JS is unchanged.
@clawsweeper clawsweeper Bot removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 14, 2026
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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 Nov 14, 2026
@fuller-stack-dev
fuller-stack-dev merged commit 01ecda4 into openclaw:main Nov 14, 2026
126 checks passed
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

@fuller-stack-dev
fuller-stack-dev deleted the fix/webkit-closing-overlay-anchor-hang branch November 14, 2026 17:44
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 15, 2026
…ng menu (openclaw#198658)

* fix(ui): stop WebKit freezing when a picker replaces an opening menu

WebKit never finished style resolution when an anchored overlay that was
still opening got closed by another overlay in its exclusive group while
the layout changed, for example opening the sidebar Agent menu, toggling
Home, then opening a settings picker. The closing surface kept retrying
its position-try fallbacks and the Control UI froze until reload.

A closing overlay is only fading out, so it now drops position-try
fallbacks. The new WebKit e2e suite replays the swap through the real
Control UI and fails on the previous stylesheet.

Refs openclaw#196820

* fix(ui): keep the closing-overlay rule within the CSS size ratchet

Select closing surfaces by data-phase alone. The rule only affects anchored elements, and the shorter selector keeps total CSS growth under the 64 B build-variance allowance.

* fix(ui): keep the closing-overlay rule out of the boot JS bundles

overlay.css is also embedded as a string in the boot JS for shadow-hosted surfaces, so adding to it grew the boot bundles by ~320 B gzip under the performance ratchet. Move the rule to the document stylesheet: the light-DOM menus and pickers that reproduce the WebKit hang keep the fix, and the boot JS is unchanged.
RomneyDa added a commit that referenced this pull request Nov 15, 2026
Keep the exact upstream CSS repair and WebKit shard registration. Adapt the upstream scenario to actual 11.4 two-agent settings controls, preserving evaluation failures and checking the specific competing picker. This is positive integration coverage: the baseline probe passes, so no baseline-red freeze reproduction is claimed. Independent CSS, registration, and final test reviews found no remaining actionable findings. Local visual/runtime gaps defer to fresh FRV per operator instruction.

(cherry picked from commit 01ecda4)

Co-authored-by: Jason (Json) <[email protected]>

Co-authored-by: RomneyDa <[email protected]>

Co-authored-by: vincentkoc <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 15, 2026
Port Telegram callbacks, hook session keys, private-topic approvals and
interactive widgets with complete send/edit/route security companions.
Include Feishu captioned media, iOS permission Sendable callbacks,
WebKit animation/menu retirement and pending automations props handling.
Keep Matrix malformed formatted-mention parsing linear-time.
Adapt the 11.4 equivalents to the fixed beta baseline where available.

Source PRs: #196217, #191585, #196822, #194027, #197519, #198038,
#196991, #198380, #198658, #184432. Companion scope: #191647, #192162,
#198022, #197271, #194146; #197670 is folded into #197519 equivalent.

(cherry picked from commit 928c118)
(cherry picked from commit 569ca48)
(cherry picked from commit efa744e)
(cherry picked from commit c301da9)
(cherry picked from commit 641c4d5)
(cherry picked from commit b9d3fb4)
(cherry picked from commit a213a51)
(cherry picked from commit ec46689)
(cherry picked from commit 779d22e)
(cherry picked from commit 129ccc3)
(cherry picked from commit 849c050)
(cherry picked from commit b22f35f)
(cherry picked from commit 8b414e9)
(cherry picked from commit 01ecda4)
(cherry picked from commit f978e54)
(cherry picked from commit 6e60479)
(cherry picked from commit ec7b49a)
(cherry picked from commit 1d72ad0)
(cherry picked from commit 5e2c66f)

(cherry picked from commit dfb6454)

Co-authored-by: RomneyDa <[email protected]>

(cherry picked from commit f7c581c7f8bf0e57c7d8799e928a121b24462450)

Co-authored-by: vincentkoc <[email protected]>
fuller-stack-dev added a commit that referenced this pull request Nov 24, 2026
…ss the sidebar rail

* fix(ui): Control UI freezes in WebKit when a sidebar rail tooltip hands off to a pinned page

Shadow-hosted overlay surfaces never received the document rule that stops
closing and hidden surfaces from trying position fallbacks (#198658, #199177).
A rail tooltip closing as a pinned page's tooltip opens then left the top layer
with its fallbacks, and WebKit's anchor-positioned style resolution never
finished. Mirror the rule in the shadow-only overlay reset.

The agent-menu swap test no longer reproduces its freeze without the document
rule on current main, so it is replaced by the rail tooltip hand-off.

Related: #196820

* fix: Control UI freezes in Safari and the Mac app when you hover across the sidebar rail

OpenClaw-Publication: 9ab2f67f-a9cd-8176-9264-18486a27bf36
tideclaw-bot pushed a commit that referenced this pull request Nov 25, 2026
…ss the sidebar rail

* fix(ui): Control UI freezes in WebKit when a sidebar rail tooltip hands off to a pinned page

Shadow-hosted overlay surfaces never received the document rule that stops
closing and hidden surfaces from trying position fallbacks (#198658, #199177).
A rail tooltip closing as a pinned page's tooltip opens then left the top layer
with its fallbacks, and WebKit's anchor-positioned style resolution never
finished. Mirror the rule in the shadow-only overlay reset.

The agent-menu swap test no longer reproduces its freeze without the document
rule on current main, so it is replaced by the rail tooltip hand-off.

Related: #196820

* fix: Control UI freezes in Safari and the Mac app when you hover across the sidebar rail

OpenClaw-Publication: 9ab2f67f-a9cd-8176-9264-18486a27bf36
(cherry picked from commit 0aa27dd)
Co-authored-by: RomneyDa <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 25, 2026
…ss the sidebar rail

* fix(ui): Control UI freezes in WebKit when a sidebar rail tooltip hands off to a pinned page

Shadow-hosted overlay surfaces never received the document rule that stops
closing and hidden surfaces from trying position fallbacks (openclaw#198658, openclaw#199177).
A rail tooltip closing as a pinned page's tooltip opens then left the top layer
with its fallbacks, and WebKit's anchor-positioned style resolution never
finished. Mirror the rule in the shadow-only overlay reset.

The agent-menu swap test no longer reproduces its freeze without the document
rule on current main, so it is replaced by the rail tooltip hand-off.

Related: openclaw#196820

* fix: Control UI freezes in Safari and the Mac app when you hover across the sidebar rail

OpenClaw-Publication: 9ab2f67f-a9cd-8176-9264-18486a27bf36
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 P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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