mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-24 07:30:12 +01:00
Fixed accessibility issue with search result list
This commit is contained in:
parent
89a77c5c0b
commit
a200e7d63d
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -240,7 +240,7 @@
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
<script src="{{ 'assets/javascripts/bundle.ba449ae6.min.js' | url }}"></script>
|
||||
<script src="{{ 'assets/javascripts/bundle.51d95adb.min.js' | url }}"></script>
|
||||
{% for path in config.extra_javascript %}
|
||||
<script src="{{ path | url }}"></script>
|
||||
{% endfor %}
|
||||
|
@ -30,7 +30,7 @@
|
||||
<div class="md-search-result__meta">
|
||||
{{ lang.t("search.result.initializer") }}
|
||||
</div>
|
||||
<ol class="md-search-result__list"></ol>
|
||||
<ol class="md-search-result__list" role="presentation"></ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -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(
|
||||
|
@ -97,7 +97,7 @@
|
||||
<div class="md-search-result__meta">
|
||||
{{ lang.t("search.result.initializer") }}
|
||||
</div>
|
||||
<ol class="md-search-result__list"></ol>
|
||||
<ol class="md-search-result__list" role="presentation"></ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user