[GTK][WPE] WebKitWebContext should identify web views by their WebPageProxy identifier
[WebKit-https.git] / LayoutTests / fast / events / focusing-element-with-tabindex-by-tap-or-click.html
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../../resources/ui-helper.js"></script>
5 <script src="../../resources/js-test.js"></script>
6 <div id="contentEditableElement" contenteditable>An element with contenteditable attribute</div>
7 <section id="elementWithTabIndexAndClickHandler" onclick="false" tabindex="0">An element with click event handler and tabindex attribute</section>
8 <main id="elementWithTabIndex" tabindex="0">An element with tabindex attribute</main>
9 <style>
10 div:focus {
11     background: #9cf;
12 }
13 </style>
14 <script>
15
16 description('This tests tapping or clicking on an element with tabindex would focus the element.<br>'
17     + 'To manually test, tap or click on each element below. Each element should be focused');
18 jsTestIsAsync = true;
19
20 async function runTests() {
21     await UIHelper.activateElementAndWaitForInputSession(contentEditableElement);
22     shouldBe('"Activated contentEditableElement"; document.activeElement', 'contentEditableElement');
23
24     await UIHelper.activateAt(elementWithTabIndexAndClickHandler.offsetLeft + 5, elementWithTabIndexAndClickHandler.offsetTop + 5);
25     shouldBe('"Activated elementWithTabIndexAndClickHandler"; document.activeElement', 'elementWithTabIndexAndClickHandler');
26
27     await UIHelper.waitForKeyboardToHide();
28
29     await UIHelper.activateAt(elementWithTabIndex.offsetLeft + 5, elementWithTabIndex.offsetTop + 5);
30     shouldBe('"Activated elementWithTabIndex"; document.activeElement', 'elementWithTabIndex');
31 }
32
33 UIHelper.wait(runTests());
34
35 </script>
36 </body>
37 </html>