Skip to content

Commit

Permalink
Make animations to display:none also apply inert
Browse files Browse the repository at this point in the history
w3c/csswg-drafts#8389

Bug: 1422736
Change-Id: Ica770040e6932b00fdd0c3a2051c9aee745e4b2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4342420
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Reviewed-by: Robert Flack <flackr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1118269}
  • Loading branch information
josepharhar authored and cookiecrook committed Mar 29, 2023
1 parent 2d41eda commit e9afd04
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions css/css-transitions/inert-while-transitioning-to-display-none.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<link rel=author href="mailto:jarhar@chromium.org">
<link rel=help href="https://github.com/w3c/csswg-drafts/issues/8389">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<dialog>
<button>button</button>
</dialog>

<style>
dialog.ready {
transition: display 500ms;
}
</style>

<script>
promise_test(async () => {
const dialog = document.querySelector('dialog');
const button = document.querySelector('button');

dialog.showModal();
button.blur(); // Dialog initial focus focused the button
dialog.classList.add('ready');

dialog.close();
await new Promise(resolve => requestAnimationFrame(resolve));
button.focus();

assert_not_equals(document.activeElement, button, 'Inert elements should not be focusable.');
}, 'Elements which are transitioning to display:none should be inert.');
</script>

0 comments on commit e9afd04

Please sign in to comment.