Skip to content

Commit

Permalink
Meta: Improve PR preview warning accessibility
Browse files Browse the repository at this point in the history
Pressing Escape now dismisses the open dialog.
  • Loading branch information
gibson042 committed Dec 28, 2024
1 parent b391359 commit 69c859c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions scripts/pr_preview_warning.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,13 @@
Instead, see {{REPO_LINK}} for the living specification.
</p>
</details>
<script>
{
const dismissWarnings = evt => {
if (evt.code !== 'Escape') return;
const close = el => el.open && Object.assign(el, { open: false });
document.querySelectorAll('details.annoying-warning').forEach(close);
};
document.addEventListener('keydown', dismissWarnings, { passive: true });
}
</script>

0 comments on commit 69c859c

Please sign in to comment.