Skip to content

Commit 69c859c

Browse files
committed
Meta: Improve PR preview warning accessibility
Pressing Escape now dismisses the open dialog.
1 parent b391359 commit 69c859c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

scripts/pr_preview_warning.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,13 @@
5656
Instead, see {{REPO_LINK}} for the living specification.
5757
</p>
5858
</details>
59+
<script>
60+
{
61+
const dismissWarnings = evt => {
62+
if (evt.code !== 'Escape') return;
63+
const close = el => el.open && Object.assign(el, { open: false });
64+
document.querySelectorAll('details.annoying-warning').forEach(close);
65+
};
66+
document.addEventListener('keydown', dismissWarnings, { passive: true });
67+
}
68+
</script>

0 commit comments

Comments
 (0)