From 1e538e62b161c1743c7a79a549833764fd23ac06 Mon Sep 17 00:00:00 2001 From: 0m364 <13804150+0m364@users.noreply.github.com> Date: Thu, 28 May 2026 10:51:19 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Palette:=20Improve=20accessibili?= =?UTF-8?q?ty=20of=20modal=20triggers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added semantic `role="button"` and `aria-haspopup="dialog"` to all modal trigger anchor tags across `concepts.html`, `products.html`, and `contact.html`. Implemented Spacebar key support in `modal.js` to ensure the modal can be opened by keyboard users who expect button-like interactions. Recorded this UX improvement in the Palette journal. --- .Jules/palette.md | 4 ++++ concepts.html | 2 +- contact.html | 2 +- modal.js | 6 ++++++ products.html | 2 +- 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.Jules/palette.md b/.Jules/palette.md index 7c7c523..09e3a89 100644 --- a/.Jules/palette.md +++ b/.Jules/palette.md @@ -29,3 +29,7 @@ ## 2026-06-12 - Robust Skip-to-Content Links **Learning:** Adding a "Skip to main content" link is a critical accessibility requirement for keyboard users. To make it robust, it needs to be hidden visually but appear when focused using `transform: translateY(-100%)` instead of magic pixel numbers, and the target container (e.g., `
`) must have a matching `id` and `tabindex="-1"` so it can programmatically receive focus across all browsers. **Action:** Always include a visually hidden 'Skip to main content' link immediately after the opening `` tag. Set the main content container with an `id` and explicitly `tabindex="-1"`. + +## 2026-06-21 - Anchor Tags as Modal Triggers +**Learning:** Using `` tags with `href="#"` as modal triggers causes two major accessibility issues: 1) screen readers announce them as "links" instead of "buttons", confusing users about their expected interaction (navigation vs. dialog), and 2) native links only activate with the `Enter` key, whereas keyboard users expect buttons to also activate with the `Spacebar`. +**Action:** When an anchor tag functions as a button, always add `role="button"` and `aria-haspopup="dialog"`. Additionally, bind a `keydown` event listener for the `Spacebar` key (and call `e.preventDefault()` to stop page scrolling) to ensure full keyboard functionality. diff --git a/concepts.html b/concepts.html index d4e1807..13b8873 100644 --- a/concepts.html +++ b/concepts.html @@ -19,7 +19,7 @@

CHARLES WILLIAMS

Products Concepts Contact - OSINT + OSINT
diff --git a/contact.html b/contact.html index b30b503..15d119b 100644 --- a/contact.html +++ b/contact.html @@ -49,7 +49,7 @@

Get in Touch

- + OSINT diff --git a/modal.js b/modal.js index 994d6bd..7ad7852 100644 --- a/modal.js +++ b/modal.js @@ -56,6 +56,12 @@ const openModal = (e) => { const btns = document.querySelectorAll('#sitrep-btn'); btns.forEach(btn => { btn.addEventListener('click', openModal); + btn.addEventListener('keydown', (e) => { + if (e.key === ' ' || e.key === 'Spacebar') { + e.preventDefault(); + openModal(e); + } + }); }); // Close modal via button diff --git a/products.html b/products.html index f5f0835..01f1a6c 100644 --- a/products.html +++ b/products.html @@ -20,7 +20,7 @@

CHARLES WILLIAMS

Products Concepts Contact - OSINT + OSINT