Skip to content

Commit 914bcb9

Browse files
alflennikhoward-emcking65
authored
Button Example: Add AT support tables from ARIA-AT (pull w3c#2569)
Adds a section to the button example page after the source code section that shows a table of screen reader support levels for the example. The data is pulled from the aria-at project (aria-at.w3.org) and displayed in an iframe. --------- Co-authored-by: Howard Edwards <howarde.edwards@gmail.com> Co-authored-by: Matt King <a11yThinker@Gmail.com>
1 parent d02c812 commit 914bcb9

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

content/patterns/button/examples/button.html

+21
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,27 @@ <h2 id="sc1_label">HTML Source Code</h2>
195195
sourceCode.make();
196196
</script>
197197
</section>
198+
199+
<section id="at-support">
200+
<h2>Assistive Technology Support</h2>
201+
<h3>Command Button</h3>
202+
<iframe
203+
class="support-levels-command-button"
204+
src="https://aria-at.w3.org/embed/reports/command-button"
205+
height="100"
206+
allow="clipboard-write"
207+
style="border-style: none; width: 100%;">
208+
</iframe>
209+
210+
<h3>Toggle Button</h3>
211+
<iframe
212+
class="support-levels-toggle-button"
213+
src="https://aria-at.w3.org/embed/reports/toggle-button"
214+
height="100"
215+
allow="clipboard-write"
216+
style="border-style: none; width: 100%;">
217+
</iframe>
218+
</section>
198219
</main>
199220
</body>
200221
</html>

content/shared/js/app.js

+14
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
// Rewrite links so they point to the proper spec document
1313
window.addEventListener('DOMContentLoaded', resolveSpecLinks, false);
1414

15+
// Support levels iframes should not show scrollbars, so a message with the
16+
// correct height will be posted from the iframe.
17+
window.addEventListener('message', fixIframeHeight);
18+
1519
async function addExampleUsageWarning() {
1620
// Determine we are on an example page
1721
if (!document.location.href.match(/examples\/[^/]+\.html/)) return;
@@ -43,4 +47,14 @@
4347
const fixSpecLink = specLinks({ specStatus: 'ED' });
4448
document.querySelectorAll('a[href]').forEach(fixSpecLink);
4549
}
50+
51+
function fixIframeHeight(event) {
52+
const data = event.data;
53+
if (!data.iframe || !data.height || isNaN(data.height)) {
54+
return;
55+
}
56+
const iframe = document.querySelector(`.${data.iframe}`);
57+
if (!iframe) return;
58+
iframe.style.height = data.height + 'px';
59+
}
4660
})();

cspell.json

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100
"Hoyt",
101101
"IDREF",
102102
"IDREFS",
103+
"iframes",
103104
"imgs",
104105
"Iskandar",
105106
"issie",

0 commit comments

Comments
 (0)