mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03: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>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% 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 %}
|
{% for path in config.extra_javascript %}
|
||||||
<script src="{{ path | url }}"></script>
|
<script src="{{ path | url }}"></script>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
<div class="md-search-result__meta">
|
<div class="md-search-result__meta">
|
||||||
{{ lang.t("search.result.initializer") }}
|
{{ lang.t("search.result.initializer") }}
|
||||||
</div>
|
</div>
|
||||||
<ol class="md-search-result__list"></ol>
|
<ol class="md-search-result__list" role="presentation"></ol>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -46,7 +46,8 @@ import { translation } from "~/_"
|
|||||||
import {
|
import {
|
||||||
getElement,
|
getElement,
|
||||||
getOptionalElement,
|
getOptionalElement,
|
||||||
watchElementBoundary
|
watchElementBoundary,
|
||||||
|
watchToggle
|
||||||
} from "~/browser"
|
} from "~/browser"
|
||||||
import {
|
import {
|
||||||
SearchMessage,
|
SearchMessage,
|
||||||
@ -103,6 +104,12 @@ export function mountSearchResult(
|
|||||||
const meta = getElement(":scope > :first-child", el)
|
const meta = getElement(":scope > :first-child", el)
|
||||||
const list = getElement(":scope > :last-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 */
|
/* Update search result metadata */
|
||||||
push$
|
push$
|
||||||
.pipe(
|
.pipe(
|
||||||
|
@ -97,7 +97,7 @@
|
|||||||
<div class="md-search-result__meta">
|
<div class="md-search-result__meta">
|
||||||
{{ lang.t("search.result.initializer") }}
|
{{ lang.t("search.result.initializer") }}
|
||||||
</div>
|
</div>
|
||||||
<ol class="md-search-result__list"></ol>
|
<ol class="md-search-result__list" role="presentation"></ol>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user