A11Y: add live area for search menu, labels (#19061)
This commit is contained in:
parent
d2a8884127
commit
a5f2099884
|
@ -90,6 +90,12 @@ function createSearchResult({ type, linkField, builder }) {
|
||||||
return createWidget(`search-result-${type}`, {
|
return createWidget(`search-result-${type}`, {
|
||||||
tagName: "ul.list",
|
tagName: "ul.list",
|
||||||
|
|
||||||
|
buildAttributes() {
|
||||||
|
return {
|
||||||
|
"aria-label": `${type} ${I18n.t("search.results")}`,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
html(attrs) {
|
html(attrs) {
|
||||||
return attrs.results.map((r) => {
|
return attrs.results.map((r) => {
|
||||||
let searchResultId;
|
let searchResultId;
|
||||||
|
@ -640,7 +646,13 @@ createWidget("search-menu-assistant-item", {
|
||||||
const attributes = {};
|
const attributes = {};
|
||||||
attributes.href = "#";
|
attributes.href = "#";
|
||||||
|
|
||||||
let content = [iconNode(attrs.icon || "search")];
|
let content = [
|
||||||
|
h(
|
||||||
|
"span",
|
||||||
|
{ attributes: { "aria-label": I18n.t("search.title") } },
|
||||||
|
iconNode(attrs.icon || "search")
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
if (prefix) {
|
if (prefix) {
|
||||||
content.push(h("span.search-item-prefix", `${prefix} `));
|
content.push(h("span.search-item-prefix", `${prefix} `));
|
||||||
|
|
|
@ -193,6 +193,12 @@ export default createWidget("search-menu", {
|
||||||
services: ["search"],
|
services: ["search"],
|
||||||
searchData,
|
searchData,
|
||||||
|
|
||||||
|
buildAttributes() {
|
||||||
|
return {
|
||||||
|
"aria-live": "polite",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
buildKey: () => "search-menu",
|
buildKey: () => "search-menu",
|
||||||
|
|
||||||
defaultState(attrs) {
|
defaultState(attrs) {
|
||||||
|
|
|
@ -2500,6 +2500,7 @@ en:
|
||||||
other: "<span>%{count}%{plus} results for</span><span class='term'>%{term}</span>"
|
other: "<span>%{count}%{plus} results for</span><span class='term'>%{term}</span>"
|
||||||
title: "Search"
|
title: "Search"
|
||||||
full_page_title: "Search"
|
full_page_title: "Search"
|
||||||
|
results: "results"
|
||||||
no_results: "No results found."
|
no_results: "No results found."
|
||||||
no_more_results: "No more results found."
|
no_more_results: "No more results found."
|
||||||
post_format: "#%{post_number} by %{username}"
|
post_format: "#%{post_number} by %{username}"
|
||||||
|
|
Loading…
Reference in New Issue