summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/inert-node-is-unselectable.html
blob: 2889e1e90a563456998835fc2c30658973673bb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<!DOCTYPE html>
<link rel=author href="mailto:jarhar@chromium.org">
<link rel=author href="mailto:falken@chromium.org">
<link rel=help href="https://html.spec.whatwg.org/multipage/interactive-elements.html#the-dialog-element">
<link rel=help href="https://bugs.chromium.org/p/chromium/issues/detail?id=252071">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

Here is a text node you can't select while the dialog is open.
<dialog>I'm selectable.</dialog>

<script>
test(() => {
  const dialog = document.querySelector('dialog');
  dialog.showModal();
  document.execCommand('SelectAll');
  assert_equals(window.getSelection().toString(), "I'm selectable.");
}, 'Test that inert nodes cannot be selected. The test passes if the only text you can select is inside the dialog.');
</script>