Skip to content

Commit

Permalink
Make the document blocked by the topmost element in the top layer
Browse files Browse the repository at this point in the history
Spec: https://html.spec.whatwg.org/multipage/#blocked-by-a-modal-dialog

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

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1200896
gecko-commit: c7ae88fd1bd7e1d7d6d622eaa37439b653dc13d2
gecko-integration-branch: autoland
gecko-reviewers: emilio
  • Loading branch information
sefeng211 authored and moz-wptsync-bot committed Aug 11, 2020
1 parent 015bdde commit 573565c
Showing 1 changed file with 34 additions and 0 deletions.
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body id="body">
<dialog>
This is a dialog
</dialog>
<input />
<script>
"use strict";
function testFocus(element, expectFocus) {
var focusedElement = null;
element.addEventListener('focus', function() { focusedElement = element; }, false);
element.focus();
var theElement = element;
assert_equals(focusedElement === theElement, expectFocus, element.id);
}

test(function() {
var dialog = document.querySelector('dialog');
dialog.showModal();

var input = document.querySelector('input');
testFocus(input, false);

dialog.remove();
testFocus(input, true);
}, "Test that removing dialog unblocks the document.");
</script>
</body>
</html>

0 comments on commit 573565c

Please sign in to comment.