From 4d4bf5f7eeca421821c0aa3de0370229c1a233f9 Mon Sep 17 00:00:00 2001 From: Ken Lui <116421546+kenlhlui@users.noreply.github.com> Date: Tue, 13 Oct 2026 15:39:43 -0400 Subject: [PATCH] fix: enhance accessibility for search and guide cards --- _layouts/minimal_search.html | 4 ++-- assets/css/search.css | 3 +++ assets/js/search/render.js | 7 ++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/_layouts/minimal_search.html b/_layouts/minimal_search.html index 5aa79b65..2c4c2afd 100644 --- a/_layouts/minimal_search.html +++ b/_layouts/minimal_search.html @@ -50,7 +50,7 @@

📚 Lear
- + Ctrl+K
@@ -65,7 +65,7 @@

📚 Lear

Filters

- +

Technique

diff --git a/assets/css/search.css b/assets/css/search.css index 4a66491c..bb1f4474 100644 --- a/assets/css/search.css +++ b/assets/css/search.css @@ -296,6 +296,9 @@ header p.header-meta { color: var(--text-body); transition: background-color 0.3s, border-color 0.3s; background: rgba(255, 255, 255, 0.95); + /* Safari otherwise draws its own search field and ignores the radius and padding */ + -webkit-appearance: none; + appearance: none; } /* Opacity reset: Firefox dims placeholders by default, which would undo the diff --git a/assets/js/search/render.js b/assets/js/search/render.js index 8cf6e909..b21e8076 100644 --- a/assets/js/search/render.js +++ b/assets/js/search/render.js @@ -34,9 +34,9 @@ function guideCard(guide, uniqueId) { return `
-

${escapeHTML(guide.title)}

+

${escapeHTML(guide.title)}

${description ? renderMarkdown(description) : ''}
- +
${tagButtons('technique', getArrayValues(guide.technique))} ${tagButtons('tool', getArrayValues(guide.tool))} @@ -113,7 +113,8 @@ function updatePageInfo() { // Toggle description expand/collapse function toggleDescription(description, button) { const expanded = description.classList.toggle('expanded'); - button.textContent = expanded ? 'Read less' : 'Read more'; + // Swap only the visible text node so the hidden "about {title}" stays in the name + button.firstChild.nodeValue = expanded ? 'Read less' : 'Read more'; button.setAttribute('aria-expanded', String(expanded)); }