canvas-click.html (1023B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>Clicking on a text-selectable canvas should not select it</title> 4 <link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez"> 5 <link rel="author" href="https://mozilla.com" title="Mozilla"> 6 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1969829"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <script src="/resources/testdriver.js"></script> 10 <script src="/resources/testdriver-vendor.js"></script> 11 <style> 12 :root { user-select: none } 13 canvas { 14 user-select: text; 15 outline: 2px solid hotpink; 16 background-color: green; 17 width: 200px; 18 height: 200px; 19 } 20 </style> 21 Clicking the green square should not select it.<br> 22 <canvas></canvas> 23 <script> 24 promise_test(async function() { 25 await test_driver.click(document.querySelector("canvas")); 26 assert_true(getSelection().isCollapsed, "Clicking a canvas shouldn't generate a non-collapsed selection"); 27 }); 28 </script>