Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Button Example: Add AT support tables from ARIA-AT #2569

Merged
merged 15 commits into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions content/patterns/button/examples/button.html
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,25 @@ <h2 id="sc1_label">HTML Source Code</h2>
sourceCode.make();
</script>
</section>

<section id="at-support">
<h2>Assistive Technology Support</h2>
<iframe
howard-e marked this conversation as resolved.
Show resolved Hide resolved
class="support-levels-command-button"
howard-e marked this conversation as resolved.
Show resolved Hide resolved
src="https://aria-at.w3.org/embed/reports/command-button?title=Command+Button"
height="500"
allow="clipboard-write"
style="border-style: none; width: 100%;">
</iframe>

<iframe
class="support-levels-toggle-button"
src="https://aria-at.w3.org/embed/reports/toggle-button"
height="500"
allow="clipboard-write"
style="border-style: none; width: 100%;">
</iframe>
</section>
howard-e marked this conversation as resolved.
Show resolved Hide resolved
</main>
</body>
</html>
15 changes: 15 additions & 0 deletions content/shared/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
// Rewrite links so they point to the proper spec document
window.addEventListener('DOMContentLoaded', resolveSpecLinks, false);

// Support levels iframes should not show scrollbars, so a message with the
// correct height will be posted from the iframe.
window.addEventListener('message', fixIframeHeight);

async function addExampleUsageWarning() {
// Determine we are on an example page
if (!document.location.href.match(/examples\/[^/]+\.html/)) return;
Expand Down Expand Up @@ -43,4 +47,15 @@
const fixSpecLink = specLinks({ specStatus: 'ED' });
document.querySelectorAll('a[href]').forEach(fixSpecLink);
}

function fixIframeHeight(event) {
const data = event.data;
if (!data.iframe || !data.height || isNaN(data.height)) {
return;
}
const iframe = document.querySelector(`.${data.iframe}`);
if (!iframe) return;
const magicNumberAdjustment = 35;
iframe.style.height = `${data.height + magicNumberAdjustment}px`;
}
})();
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
"Hoyt",
"IDREF",
"IDREFS",
"iframes",
"imgs",
"Iskandar",
"issie",
Expand Down