mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2026-08-04 19:45:08 -04:00
Fixed accessibility issue with search result list
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user