From bbf178c5eef3df1376d0921d69ec393cd21d21fb Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Fri, 13 Mar 2026 13:53:00 +0100 Subject: [PATCH] Only focus the undo bar when the focus isn't inside It should fix the test "must work properly when selecting undo by keyboard" which calls focus() but it can be steal by fixed callback in setTimeout. --- web/editor_undo_bar.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/editor_undo_bar.js b/web/editor_undo_bar.js index 1cb3ed90a..c2d44e9e5 100644 --- a/web/editor_undo_bar.js +++ b/web/editor_undo_bar.js @@ -105,7 +105,9 @@ class EditorUndoBar { // Without the setTimeout, VoiceOver will read out the document title // instead of the popup label. this.#focusTimeout = setTimeout(() => { - this.#container.focus(); + if (!this.#container.contains(document.activeElement)) { + this.#container.focus(); + } this.#focusTimeout = null; }, 100); }