Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/interaction/focus/the-autofocus-attribute/queue-non-focusable.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/utils.js"></script>
<textarea autofocus disabled></textarea>
<select autofocus></select>
<script>
'use strict';
promise_test(async () => {
const [textarea, select] = document.querySelectorAll('[autofocus]');
textarea.disabled = false;
await waitUntilStableAutofocusState();
assert_equals(document.activeElement, textarea);
assert_not_equals(document.activeElement, select);
}, 'If the first autofocus element is not focusable, but becomes focusable before a frame, it should be focused.');
</script>