summaryrefslogtreecommitdiffstats
path: root/dom/events/test/test_focus_abspos.html
blob: 8798c4ed110a28a3202d1d016362c3befabd6301 (plain)
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
32
<!doctype html>
<title>Test for bug 1424633: clicking on an oof descendant focus its focusable ancestor</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<style>
  #focusable {
    width: 100px;
    height: 100px;
    background-color: blue;
  }
  #oof {
    background-color: green;
    position: absolute;
    top: 25px;
  }
</style>
<div tabindex="0" id="focusable">
  <span id="oof">Absolute</span>
</div>
<script>
window.onload = function() {
  async_test(function(t) {
    document.body.offsetTop;
    setTimeout(t.step_func_done(function() {
      let span = document.querySelector("#oof");
      synthesizeMouseAtCenter(span, {type: "mousedown"});
      assert_equals(document.activeElement, document.querySelector("#focusable"));
    }), 0);
  }, "Clicking on an abspos descendant focus its focusable ancestor");
}
</script>