Use an input instead of a button, just to be safe
diff --git a/html/semantics/forms/autofocus/focus-even-if-in-contenteditable.html b/html/semantics/forms/autofocus/focus-even-if-in-contenteditable.html index 7592a2c..f6a4c3a 100644 --- a/html/semantics/forms/autofocus/focus-even-if-in-contenteditable.html +++ b/html/semantics/forms/autofocus/focus-even-if-in-contenteditable.html
@@ -28,11 +28,12 @@ document.querySelector("[contenteditable]").focus(); - const button = document.createElement("button"); - button.autofocus = true; + const input = document.createElement("input"); + input.type = "text"; + input.autofocus = true; - // This should queue a task on the user interaction task source to focus button. - document.body.appendChild(button); + // This should queue a task on the user interaction task source to focus input. + document.body.appendChild(input); // If waitForUserInteractionTaskSource doesn't work (which appears to be the case with Safari // 12.2/Safari Tech Preview 81), then do the test anyway after a bit. The prerequisite test @@ -42,8 +43,8 @@ new Promise(resolve => t.step_timeout(resolve, 100)) ]); - assert_equals(document.activeElement, button); -}, "The activeElement changes correctly after inserting an autofocused button"); + assert_equals(document.activeElement, input); +}, "The activeElement changes correctly after inserting an autofocused input"); function waitForUserInteractionTaskSource() { return new Promise(resolve => {