Safari: the chat composer froze after the first send
Symptom (reported 2026-12-01, every instance, Safari only). The first message goes through. After that the composer takes no input and the cursor looks stuck, until the page is reloaded. A reload brings it back, until the next send. Chrome is unaffected.
Root cause (measured in Playwright WebKit against a local monolith)
MonacoEditorView never declared @implements IAsyncDisposable, so Blazor never called its
DisposeAsync. BlazorMonaco 3.5's StandaloneCodeEditor does not dispose its editor when the component
goes away either. So every unmounted editor stayed alive, detached from the document. It stayed in
monaco.editor.getEditors() and in BlazorMonaco's registry, and the module's per-editor state lived on too.
In Chromium that is only a leak. In WebKit it freezes the chat:
- WebKit fires no blur when a focused element is removed from the document. The detached editor
therefore keeps
hasTextFocus() === truefor the rest of the page's life. - WebKit has no EditContext, so Monaco uses its textarea input path. Typed text reached the editor Monaco believes is focused, which is the detached one.
- The first send from the home composer creates the thread and navigates to it. That unmounts the home composer, which still has focus, and mounts the thread page's composer. Any re-mount of a focused composer does the same.
Measured after the first send: the visible composer's textarea.inputarea held DOM focus and stayed
empty. Meanwhile the detached editor's value grew with each typed character: "second message", then
"second messagethird message". Enter submitted nothing.
Not established: which build made this visible. The missing @implements has been there since the
component was written (git log -S finds no version that had it). A newer WebKit or Monaco build
(0.56 moved Chromium to EditContext) may be what changed.
The fix
MonacoEditorView.razor:@implements IAsyncDisposable, so its existingDisposeAsyncruns on unmount.MonacoEditorView.razor.jsdispose(editorId): also disposes the Monaco instance. It is idempotent: a disposed editor has no DOM node, so a second call does nothing. It deliberately keeps the BlazorMonaco registry entry. A late fire-and-forget interop call for that id then reaches a disposed editor, which does nothing. Without the entry it would throw "Couldn't find the editor" into the render lifecycle.
Tests
src/MeshWeaver.Portal.E2E.Test/ChatComposerWebKitConsecutiveSendsTest.csalways runs in WebKit (PortalFixture.NewAuthenticatedWebKitContextAsync). It sends three messages in a row, the first one from the home page, and asserts that each arrives and that no detached editor is left. It fails without the fix: the second message never reaches the composer.src/MeshWeaver.Blazor.Views.Test/MonacoEditorViewDisposalTest.csruns in CI. It checks that the component is anIAsyncDisposableand that the module'sdisposedisposes the instance.
The FluentUI "Pattern attribute value … is not a valid regular expression" warning
This warning is unrelated to the freeze. WebKit logs it for a FAST template placeholder
(fast-xxxxxx{fast-xxxxxx-236}fast-xxxxxx) left in an unbound pattern attribute of a Fluent web component. The
composer is a Monaco editor, not a Fluent input, and the warning appears with and without the fix.