Bug 1620898 [wpt PR 22133] - html: Convert an autofocus web test to WPT, a=testonly
authorKent Tamura <tkent@chromium.org>
Thu, 12 Mar 2020 12:09:59 +0000
changeset 518590 ff51d600d3010f7ad2e8273a9d0a1f3aea4149b9
parent 518589 c969df14bcce445163e21115da62c9f557a7c929
child 518591 00cd7d7046a1aaaee5b039a682392f4520f7988c
push id37213
push usershindli@mozilla.com
push dateFri, 13 Mar 2020 21:46:16 +0000
treeherdermozilla-central@8ef0a54d7715 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1620898, 22133, 1058203, 1059322, 2094058, 748463
milestone76.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1620898 [wpt PR 22133] - html: Convert an autofocus web test to WPT, a=testonly Automatic update from web-platform-tests html: Convert an autofocus web test to WPT and remove three redundant web tests. - Adopt autofocus-only-once.html to WPT - Remove autofocus-opera-001.html and autofocus-opera-006.html. They are covered by html/interaction/focus/the-autofocus-attribute/first.html in WPT. - Remove autofocus-opera-008.html. It's covered by |html/interaction/ focus/the-autofocus-attribute/focusable-area-in-top-document.html| in WPT Bug: 1058203, 1059322 Change-Id: I0fec1af7821ad596c522f6df56aba66504db295a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2094058 Commit-Queue: Mason Freed <masonfreed@chromium.org> Auto-Submit: Kent Tamura <tkent@chromium.org> Reviewed-by: Mason Freed <masonfreed@chromium.org> Cr-Commit-Position: refs/heads/master@{#748463} -- wpt-commits: 66671cae06e165d852bf3fd9069efdc463f41b90 wpt-pr: 22133
testing/web-platform/tests/html/interaction/focus/the-autofocus-attribute/no-autofocus-on-changing-input-type.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/interaction/focus/the-autofocus-attribute/no-autofocus-on-changing-input-type.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/utils.js"></script>
+<body>
+
+<input id="input1" autofocus>
+<select><option>o1</option></select>
+
+<script>
+"use strict";
+
+// WebKit had a bug that reattaching RenderObject triggered autofocus again.
+// https://bugs.webkit.org/show_bug.cgi?id=68513
+promise_test(async () => {
+  const input1 = document.querySelector('input');
+  const select = document.querySelector('select');
+
+  await waitUntilStableAutofocusState();
+  assert_equals(document.activeElement, input1);
+  input1.onblur = () => { input1.type = 'password'; };
+  select.focus();
+  await waitUntilStableAutofocusState();
+  assert_equals(document.activeElement, select);
+}, 'Changing input type should not refocus on the element.');
+</script>
+</body>