aboutsummaryrefslogtreecommitdiffstats
path: root/tests/html/test-synthetic-click-activation.html
blob: 011914895a7a613d421cf501441055ec315e3201 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<style>
</style>
<form action="http://example.com" method="get">
<div><input type="checkbox"></div>
<div><input type="submit"><input type="reset"></div>
<div><input type="checkbox"></div>
<div><input type="checkbox" checked></div>
<div>group 1
  <div><input type="radio"></div>
  <div><input type="radio" checked></div>
</div>
<div>group 2
  <div><input type="radio" name="a" checked></div>
  <div><input type="radio" name="a"></div>
</div>
</form>
<br>
Use the buttons below to shift "fake" focus and trigger click events. The first form widget is initually focused.
<br>
<button type=button id="left">Shift fake focus left</button><br>
<button type=button id="right">Shift fake focus right</button><br>
<button type=button id="click">Trigger synthetic click</button><br>


<script>
i = 0;
tags = document.getElementsByTagName("input");
document.getElementById("left").onclick=function(){i--;}
document.getElementById("right").onclick=function(){i++;}
document.getElementById("click").onclick=function(){tags[i].click()}
</script>