Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<meta charset="utf-8">
<title>Inputs remain focusable upon changing type</title>
<link rel="help" href="">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<h1>Can still focus on inputs that change types</h1>
<input type="text" value="123" onfocus="'number'"
promise_test(() => {
// Click the input to attempt to focus on it
const target = document.querySelector("input");
const actions = new test_driver.Actions();
return actions.pointerMove(0, 0, {origin: target})
.pointerDown({button: actions.ButtonType.LEFT})
.pointerUp({button: actions.ButtonType.LEFT})
.then(() => assert_equals(document.activeElement, target,
"The element was correctly focused"));
}, "Can change an input's type during focus handler without breaking focus");