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

@ -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 %}

View File

@ -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>

View File

@ -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(

View File

@ -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>