inert-node-is-unselectable.html (846B)
1 <!DOCTYPE html> 2 <link rel=author href="mailto:jarhar@chromium.org"> 3 <link rel=author href="mailto:falken@chromium.org"> 4 <link rel=help href="https://html.spec.whatwg.org/multipage/interactive-elements.html#the-dialog-element"> 5 <link rel=help href="https://bugs.chromium.org/p/chromium/issues/detail?id=252071"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 9 Here is a text node you can't select while the dialog is open. 10 <dialog>I'm selectable.</dialog> 11 12 <script> 13 test(() => { 14 const dialog = document.querySelector('dialog'); 15 dialog.showModal(); 16 document.execCommand('SelectAll'); 17 assert_equals(window.getSelection().toString(), "I'm selectable."); 18 }, 'Test that inert nodes cannot be selected. The test passes if the only text you can select is inside the dialog.'); 19 </script>