A11Y: Add more descriptive labels for some dropdowns (#14402)

This commit is contained in:
Penar Musaraj 2021-09-21 11:19:49 -04:00 committed by GitHub
parent a4096da550
commit c52513c445
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 35 additions and 13 deletions

View File

@ -4,4 +4,6 @@ export default Component.extend({
tagName: "div", tagName: "div",
classNames: ["fps-result"], classNames: ["fps-result"],
classNameBindings: ["bulkSelectEnabled"], classNameBindings: ["bulkSelectEnabled"],
attributeBindings: ["role"],
role: "listitem",
}); });

View File

@ -27,6 +27,9 @@
everyTag=true everyTag=true
unlimitedTagCount=true unlimitedTagCount=true
onChange=(action "onChangeSearchTermForTags") onChange=(action "onChangeSearchTermForTags")
options=(hash
headerAriaLabel=(i18n "search.advanced.with_tags.aria_label")
)
}} }}
{{#if showAllTagsCheckbox}} {{#if showAllTagsCheckbox}}
<section class="field"> <section class="field">
@ -124,6 +127,7 @@
onChange=(action "onChangeSearchTermForStatus") onChange=(action "onChangeSearchTermForStatus")
options=(hash options=(hash
none="user.locale.any" none="user.locale.any"
headerAriaLabel=(i18n "search.advanced.statuses.label")
clearable=true clearable=true
) )
}} }}
@ -140,6 +144,7 @@
value=searchedTerms.username value=searchedTerms.username
onChange=(action "onChangeSearchTermForUsername") onChange=(action "onChangeSearchTermForUsername")
options=(hash options=(hash
headerAriaLabel=(i18n "search.advanced.posted_by.aria_label")
maximum=1 maximum=1
excludeCurrentUser=false excludeCurrentUser=false
) )
@ -156,6 +161,9 @@
content=postTimeOptions content=postTimeOptions
value=searchedTerms.time.when value=searchedTerms.time.when
onChange=(action "onChangeWhenTime") onChange=(action "onChangeWhenTime")
options=(hash
headerAriaLabel=(i18n "search.advanced.post.time.aria_label")
)
}} }}
{{date-input {{date-input
date=searchedTerms.time.days date=searchedTerms.time.days

View File

@ -1,4 +1,4 @@
<div class="fps-result-entries"> <div class="fps-result-entries" role="list">
{{#each posts as |post|}} {{#each posts as |post|}}
{{search-result-entry post=post bulkSelectEnabled=bulkSelectEnabled selected=selected highlightQuery=highlightQuery}} {{search-result-entry post=post bulkSelectEnabled=bulkSelectEnabled selected=selected highlightQuery=highlightQuery}}
{{/each}} {{/each}}

View File

@ -10,7 +10,7 @@
{{track-selected selectedList=selected selectedId=post.topic class="bulk-select"}} {{track-selected selectedList=selected selectedId=post.topic class="bulk-select"}}
{{/if}} {{/if}}
<a href={{post.url}} {{action "logClick" post.topic_id}} class="search-link"> <a href={{post.url}} {{action "logClick" post.topic_id}} class="search-link" role="heading">
{{raw "topic-status" topic=post.topic showPrivateMessageIcon=true}} {{raw "topic-status" topic=post.topic showPrivateMessageIcon=true}}
<span class="topic-title"> <span class="topic-title">
{{#if post.useTopicTitleHeadline}} {{#if post.useTopicTitleHeadline}}

View File

@ -1,7 +1,7 @@
{{#d-section pageClass="search" class="search-container"}} {{#d-section pageClass="search" class="search-container"}}
{{scroll-tracker name="full-page-search" tag=searchTerm class="hidden"}} {{scroll-tracker name="full-page-search" tag=searchTerm class="hidden"}}
<div class="search-header"> <div class="search-header" role="search">
<h1 class="search-page-heading"> <h1 class="search-page-heading">
{{#if hasResults}} {{#if hasResults}}
<div class="result-count" id="search-result-count" aria-live="polite"> <div class="result-count" id="search-result-count" aria-live="polite">
@ -68,7 +68,7 @@
<div class="search-advanced"> <div class="search-advanced">
{{#if hasResults}} {{#if hasResults}}
{{#if usingDefaultSearchType}} {{#if usingDefaultSearchType}}
<div class={{searchInfoClassNames}}> <div class={{searchInfoClassNames}} role="region" ariaLabel={{i18n "search.sort_or_bulk_actions"}}>
{{#if canBulkSelect}} {{#if canBulkSelect}}
{{d-button icon="list" class="btn-default bulk-select" title="topics.bulk.toggle" action=(action "toggleBulkSelect")}} {{d-button icon="list" class="btn-default bulk-select" title="topics.bulk.toggle" action=(action "toggleBulkSelect")}}
{{bulk-select-button selected=selected category=category action=(action "search")}} {{bulk-select-button selected=selected category=category action=(action "search")}}
@ -89,6 +89,7 @@
castInteger=true castInteger=true
onChange=(action (mut sortOrder)) onChange=(action (mut sortOrder))
id="search-sort-by" id="search-sort-by"
ariaLabel="Some label"
}} }}
</div> </div>
</div> </div>
@ -100,7 +101,7 @@
{{#if searching}} {{#if searching}}
{{loading-spinner size="medium"}} {{loading-spinner size="medium"}}
{{else}} {{else}}
<div class="search-results"> <div class="search-results" role="region">
{{#load-more selector=".fps-result" action=(action "loadMore")}} {{#load-more selector=".fps-result" action=(action "loadMore")}}
{{#if usingDefaultSearchType}} {{#if usingDefaultSearchType}}
{{search-result-entries {{search-result-entries

View File

@ -6,10 +6,12 @@ import { reads } from "@ember/object/computed";
export default SelectKitHeaderComponent.extend({ export default SelectKitHeaderComponent.extend({
tagName: "summary", tagName: "summary",
classNames: ["multi-select-header"], classNames: ["multi-select-header"],
attributeBindings: ["ariaLabel:aria-label"],
layout, layout,
caretUpIcon: reads("selectKit.options.caretUpIcon"), caretUpIcon: reads("selectKit.options.caretUpIcon"),
caretDownIcon: reads("selectKit.options.caretDownIcon"), caretDownIcon: reads("selectKit.options.caretDownIcon"),
ariaLabel: reads("selectKit.options.headerAriaLabel"),
caretIcon: computed( caretIcon: computed(
"selectKit.isExpanded", "selectKit.isExpanded",
"caretUpIcon", "caretUpIcon",

View File

@ -1,4 +1,5 @@
import { computed } from "@ember/object"; import { computed } from "@ember/object";
import { or } from "@ember/object/computed";
import SelectKitHeaderComponent from "select-kit/components/select-kit/select-kit-header"; import SelectKitHeaderComponent from "select-kit/components/select-kit/select-kit-header";
import UtilsMixin from "select-kit/mixins/utils"; import UtilsMixin from "select-kit/mixins/utils";
import layout from "select-kit/templates/components/select-kit/single-select-header"; import layout from "select-kit/templates/components/select-kit/single-select-header";
@ -8,7 +9,9 @@ export default SelectKitHeaderComponent.extend(UtilsMixin, {
tagName: "summary", tagName: "summary",
layout, layout,
classNames: ["single-select-header"], classNames: ["single-select-header"],
attributeBindings: ["name", "name:aria-label"], attributeBindings: ["name", "ariaLabel:aria-label"],
ariaLabel: or("selectKit.options.headerAriaLabel", "name"),
focusIn(event) { focusIn(event) {
event.stopImmediatePropagation(); event.stopImmediatePropagation();

View File

@ -8,6 +8,7 @@
icon=icon icon=icon
showFullTitle=showFullTitle showFullTitle=showFullTitle
showCaret=showCaret showCaret=showCaret
headerAriaLabel=(i18n "topic.notifications.title")
) )
}} }}
<span class="text">{{html-safe notificationReasonText}}</span> <span class="text">{{html-safe notificationReasonText}}</span>
@ -21,6 +22,7 @@
icon=icon icon=icon
showFullTitle=showFullTitle showFullTitle=showFullTitle
showCaret=showCaret showCaret=showCaret
headerAriaLabel=(i18n "topic.notifications.title")
) )
}} }}
{{/if}} {{/if}}

View File

@ -2335,6 +2335,7 @@ en:
select_all: "Select All" select_all: "Select All"
clear_all: "Clear All" clear_all: "Clear All"
too_short: "Your search term is too short." too_short: "Your search term is too short."
sort_or_bulk_actions: "Sort or bulk select results"
result_count: result_count:
one: "<span>%{count} result for</span><span class='term'>%{term}</span>" one: "<span>%{count} result for</span><span class='term'>%{term}</span>"
other: "<span>%{count}%{plus} results for</span><span class='term'>%{term}</span>" other: "<span>%{count}%{plus} results for</span><span class='term'>%{term}</span>"
@ -2371,6 +2372,7 @@ en:
title: Advanced filters title: Advanced filters
posted_by: posted_by:
label: Posted by label: Posted by
aria_label: Filter by post author
in_category: in_category:
label: Categorized label: Categorized
in_group: in_group:
@ -2379,6 +2381,7 @@ en:
label: With Badge label: With Badge
with_tags: with_tags:
label: Tagged label: Tagged
aria_label: Filter using tags
filters: filters:
label: Only return topics/posts... label: Only return topics/posts...
title: Matching in title only title: Matching in title only
@ -2413,6 +2416,7 @@ en:
placeholder: maximum placeholder: maximum
time: time:
label: Posted label: Posted
aria_label: Filter by posted date
before: before before: before
after: after after: after
views: views: