inert-while-transitioning-to-display-none.html (891B)
1 <!DOCTYPE html> 2 <link rel=author href="mailto:jarhar@chromium.org"> 3 <link rel=help href="https://github.com/w3c/csswg-drafts/issues/8389"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 7 <dialog> 8 <button>button</button> 9 </dialog> 10 11 <style> 12 dialog.ready { 13 transition: display 500ms; 14 } 15 </style> 16 17 <script> 18 promise_test(async () => { 19 const dialog = document.querySelector('dialog'); 20 const button = document.querySelector('button'); 21 22 dialog.showModal(); 23 button.blur(); // Dialog initial focus focused the button 24 dialog.classList.add('ready'); 25 26 dialog.close(); 27 await new Promise(resolve => requestAnimationFrame(resolve)); 28 button.focus(); 29 30 assert_not_equals(document.activeElement, button, 'Inert elements should not be focusable.'); 31 }, 'Elements which are transitioning to display:none should be inert.'); 32 </script>