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.
This commit is contained in:
Calixte Denizet 2026-03-13 13:53:00 +01:00
parent b7698d617d
commit bbf178c5ee

View File

@ -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);
}