Skip to content

Commit

Permalink
Fix focus gets incorrectly cleared by PresShell::FixUpFocus if the fo…
Browse files Browse the repository at this point in the history
…cus is on area element

Differential Revision: https://phabricator.services.mozilla.com/D200950

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1878753
gecko-commit: 689c94c4147143275eaf2f8df5bd4fd179a717c9
gecko-reviewers: emilio
  • Loading branch information
sefeng211 authored and moz-wptsync-bot committed Feb 9, 2024
1 parent e164c49 commit a757293
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions html/interaction/focus/the-autofocus-attribute/autofocus-area.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#the-autofocus-attribute">
<link rel='author' href='mailto:sefeng@mozilla.com'>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/utils.js"></script>

<map name="mymap">
<area id="myarea" shape="circle" coords="100,100,80" href="#" autofocus>
</map>
<img style="width:200px; height: 200px"
usemap="#mymap"
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR42mP4%2F58BAAT%2FAf9jgNErAAAAAElFTkSuQmCC">
<script>
promise_test(async t => {
await waitForLoad(window);
await waitUntilStableAutofocusState(window);
const area = document.querySelector("area");
assert_equals(document.activeElement, area);
}, 'autofocus works on area element');
</script>

0 comments on commit a757293

Please sign in to comment.