fix(webui): restore keyboard focus after pointer use (#6735)

* fix(webui): restore focus rings for file and image shortcuts

* test(webui): wait for the welcome composer before opening model options
This commit is contained in:
chengyongru authored and GitHub committed 2026-11-20 16:12:24 +08:00
1 parent 341fd37c0c
commit 3e9024ea04
6 files changed
+34 -5

No files matched your search

+6 -1
View File
@@ -50,6 +50,11 @@ interface InstalledModality {
const installedDocuments = new WeakMap<Document, InstalledModality>();
/** Mark a keyboard action handled by a control outside the shared navigation keys. */
export function markKeyboardFocus(doc: Document): void {
doc.documentElement.dataset.focusModality = "keyboard";
}
/**
* Track whether the user is navigating by keyboard or pointer on `html[data-focus-modality]`.
*
@@ -82,7 +87,7 @@ export function installFocusModality(doc: Document = document): () => void {
root.dataset.focusModality = "pointer";
};
const onKeyDown = (event: KeyboardEvent) => {
if (isKeyboardFocusKey(event)) root.dataset.focusModality = "keyboard";
if (isKeyboardFocusKey(event)) markKeyboardFocus(doc);
};
doc.addEventListener("pointerdown", setPointer, { capture: true, passive: true });