-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsvg-duplicate-title-id-demo.html
51 lines (48 loc) · 2.53 KB
/
svg-duplicate-title-id-demo.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Duplicate IDs with aria-labelledby</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.icon {
height: 30px;
width: 30px;
}
</style>
</head>
<body>
<h1>Duplicate IDs with aria-labelledby</h1>
<p>This page has two inline SVG images. Both use aria-labelledby references to their nested title elements. These SVG title elements both have an ID of "title", but different text.</p>
<p>Here is a mailto icon:
<svg class="mailto icon" role="img" aria-labelledby="title" xmlns="http://www.w3.org/2000/svg" viewBox="0 10 70 20">
<title id="title">Mail To</title>
<path d="M56 14H8c-1.1 0-2 0.9-2 2v32c0 1.1 0.9 2 2 2h48c1.1 0 2-0.9 2-2V16C58 14.9 57.1 14 56 14zM50.5 18L32 33.4 13.5 18H50.5zM10 46V20.3l20.7 17.3C31.1 37.8 31.5 38 32 38s0.9-0.2 1.3-0.5L54 20.3V46H10z"/>
</svg>
</p>
<p>Here is an external link icon:
<svg class="extlink icon" role="img" aria-labelledby="title" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 40">
<title id="title">Link is external</title>
<path d="M48 26c-1.1 0-2 0.9-2 2v26H10V18h26c1.1 0 2-0.9 2-2s-0.9-2-2-2H8c-1.1 0-2 0.9-2 2v40c0 1.1 0.9 2 2 2h40c1.1 0 2-0.9 2-2V28C50 26.9 49.1 26 48 26z"/>
<path d="M56 6H44c-1.1 0-2 0.9-2 2s0.9 2 2 2h7.2L30.6 30.6c-0.8 0.8-0.8 2 0 2.8C31 33.8 31.5 34 32 34s1-0.2 1.4-0.6L54 12.8V20c0 1.1 0.9 2 2 2s2-0.9 2-2V8C58 6.9 57.1 6 56 6z"/>
</svg>
</p>
<h2>What do screen readers announce as the accessible names of these images?</h2>
<p>The duplicate IDs cause problems for the aria-labelledby references. Both images pick up the <strong>first</strong> element with an ID of "title", in this case the one nested inside the mail-to icon.</p>
<ul>
<li>Chromevox: Both images are announced as "Mail To".</li>
<li>Firefox 60 + NVDA 2018.2: both images are announced as "Mail To".</li>
<li>Chrome 67 + NVDA 2018.2: both images are announced as "Mail To".</li>
<li>TO DO: Voiceover + Safari (iOS)</li>
<li>TO DO: VoiceOver + Safari (macOS)</li>
<li>TO OD: JAWS + IE11</li>
<li>TO DO: JAWS + Edge</li>
<li>TO DO: JAWS + Firefox</li>
<li>TO DO: JAWS + Chrome</li>
<li>TO DO: Narrator + Edge (Windows 10)</li>
<li>TO DO: Narrator + Firefox (Windows 10)</li>
<li>TO DO: Narrator + Chrome (Windows 10)</li>
<li>TO DO: TalkBack + Chrome (Android)</li>
</ul>
</body>
</html>