summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/accessibility/aria-labelledby-overrides-aria-label.html
blob: f939165db53233752b3149ffdca42a7ba4dda411 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
</head>
<body id="body">
<p id="description">This tests that if aria-labelledby is used, then aria-label attributes are not used.</p>

<button id="using-none">Alpha</button>
<button id="using-label" aria-label="Gamma">Beta</button>
<button id="using-labelledby" aria-labelledby="epsilon" aria-label="Zeta">Delta</button>
<button id="using-labeledby" aria-labeledby="theta" aria-label="Iota">Eta</button>
<span id="epsilon">Epsilon</span>
<span id="theta">Theta</span>

<ul id="results"></ul>
<div id="console"></div>

<script>
    function getAccessibilityObject(id) {
        var element = document.getElementById(id);
        element.focus();
        return accessibilityController.focusedElement;
    }

    function output(str) {
        var results = document.getElementById("results");
        var li = document.createElement("li");
        li.appendChild(document.createTextNode(str));
        results.appendChild(li);
    }

    if (window.testRunner)
        testRunner.dumpAsText();

    if (window.accessibilityController) {
        var usingNone = getAccessibilityObject("using-none");
        output("usingNone.title: [" + usingNone.title + "]");
        output("usingNone.description:  [" + usingNone.description + "]");

        var usingLabel = getAccessibilityObject("using-label");
        output("usingLabel.title: [" + usingLabel.title + "]");
        output("usingLabel.description:  [" + usingLabel.description + "]");

        var usingLabelledby = getAccessibilityObject("using-labelledby");
        output("usingLabelledby.title: [" + usingLabelledby.title + "]");
        output("usingLabelledby.description:  [" + usingLabelledby.description + "]");

        var usingLabeledby = getAccessibilityObject("using-labeledby");
        output("usingLabeledby.title: [" + usingLabeledby.title + "]");
        output("usingLabeledby.description:  [" + usingLabeledby.description + "]");
    }

    successfullyParsed = true;
</script>

</body>
</html>