diff --git a/internal/template/templates/common/layout.html b/internal/template/templates/common/layout.html index 8aa2a4eaa6e..80c295cb2d1 100644 --- a/internal/template/templates/common/layout.html +++ b/internal/template/templates/common/layout.html @@ -116,10 +116,10 @@ -
- +
+ {{ t "search.label" }} - diff --git a/internal/ui/static/css/common.css b/internal/ui/static/css/common.css index 743d5a25927..0b098ac2b8b 100644 --- a/internal/ui/static/css/common.css +++ b/internal/ui/static/css/common.css @@ -233,18 +233,21 @@ a:hover { margin-right: 5px; } -.search details svg { +.search-summary-icon { padding: 5px; inline-size: 24px; block-size: 24px; translate: 0 -3px; } -.search details[open] svg { - rotate: 180deg; +.search-details { + + &[open] .search-summary-icon { + rotate: 180deg; + } } -.search details > summary { +.search-summary { list-style: none; display: flex; justify-content: center; @@ -252,12 +255,11 @@ a:hover { margin-inline: auto; } -.search details > summary::marker, /* Latest Chrome, Edge, Firefox */ -.search details > summary::-webkit-details-marker /* Safari */ { +.search-summary::marker, /* Latest Chrome, Edge, Firefox */ +.search-summary::-webkit-details-marker /* Safari */ { display: none; } - .search-toggle-switch { display: none; } diff --git a/internal/ui/static/js/app.js b/internal/ui/static/js/app.js index 61872ed1f87..99145d497d3 100644 --- a/internal/ui/static/js/app.js +++ b/internal/ui/static/js/app.js @@ -54,6 +54,27 @@ function checkMenuToggleModeByLayout() { } } +function fixVoiceOverDetailsSummaryBug() { + const detailsElements = document.querySelectorAll("details") + detailsElements.forEach((details) => { + const summaryElement = details.querySelector("summary") + summaryElement.setAttribute("role", "button") + setSummaryAriaExpandedByDetails(details, summaryElement) + + details.addEventListener("toggle", () => { + setSummaryAriaExpandedByDetails(details, summaryElement) + }) + }) + + function setSummaryAriaExpandedByDetails(details, summary) { + if (details.open) { + summary.setAttribute("aria-expanded", "true") + } else { + summary.setAttribute("aria-expanded", "false") + } + } +} + // Show and hide the main menu on mobile devices. function toggleMainMenu(event) { if (event.type === "keydown" && !(event.key === "Enter" || event.key === " ")) { diff --git a/internal/ui/static/js/bootstrap.js b/internal/ui/static/js/bootstrap.js index bfc898397ec..254a1c48281 100644 --- a/internal/ui/static/js/bootstrap.js +++ b/internal/ui/static/js/bootstrap.js @@ -114,6 +114,8 @@ document.addEventListener("DOMContentLoaded", () => { checkMenuToggleModeByLayout() window.addEventListener("resize", checkMenuToggleModeByLayout, { passive: true }) + fixVoiceOverDetailsSummaryBug() + const logoElement = document.querySelector(".logo") logoElement.addEventListener("click", (event) => toggleMainMenu(event)); logoElement.addEventListener("keydown", (event) => toggleMainMenu(event));