Fixed accessibility issue with search result list

This commit is contained in:
squidfunk
2023-01-14 19:59:30 +01:00
parent 89a77c5c0b
commit a200e7d63d
6 changed files with 18 additions and 11 deletions

View File

@@ -46,7 +46,8 @@ import { translation } from "~/_"
import {
getElement,
getOptionalElement,
watchElementBoundary
watchElementBoundary,
watchToggle
} from "~/browser"
import {
SearchMessage,
@@ -103,6 +104,12 @@ export function mountSearchResult(
const meta = getElement(":scope > :first-child", el)
const list = getElement(":scope > :last-child", el)
/* Reveal to accessibility tree see https://bit.ly/3iAA7t8 */
watchToggle("search")
.subscribe(active => list.setAttribute(
"role", active ? "list" : "presentation"
))
/* Update search result metadata */
push$
.pipe(