A platform for community discussion. Free, open, simple.
A11Y: Add more descriptive labels for some dropdowns (#14402)
Penar Musarajc52513c445c0
diff --git a/app/assets/javascripts/discourse/app/components/search-result-entry.js b/app/assets/javascripts/discourse/app/components/search-result-entry.jsindex 59cd22206ac..73e340671fa 100644--- a/app/assets/javascripts/discourse/app/components/search-result-entry.js+++ b/app/assets/javascripts/discourse/app/components/search-result-entry.js@@ -4,4 +4,6 @@ export default Component.extend({tagName: "div",classNames: ["fps-result"],classNameBindings: ["bulkSelectEnabled"],+ attributeBindings: ["role"],+ role: "listitem",});diff --git a/app/assets/javascripts/discourse/app/templates/components/search-advanced-options.hbs b/app/assets/javascripts/discourse/app/templates/components/search-advanced-options.hbsindex d6f7604b3bf..552e57db334 100644--- a/app/assets/javascripts/discourse/app/templates/components/search-advanced-options.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/search-advanced-options.hbs@@ -27,6 +27,9 @@everyTag=trueunlimitedTagCount=trueonChange=(action "onChangeSearchTermForTags")+ options=(hash+ headerAriaLabel=(i18n "search.advanced.with_tags.aria_label")+ )}}{{#if showAllTagsCheckbox}}<section class="field">@@ -124,6 +127,7 @@onChange=(action "onChangeSearchTermForStatus")options=(hashnone="user.locale.any"+ headerAriaLabel=(i18n "search.advanced.statuses.label")clearable=true)}}@@ -136,13 +140,14 @@</label><div class="controls">{{user-chooser- id="search-posted-by"- value=searchedTerms.username- onChange=(action "onChangeSearchTermForUsername")- options=(hash- maximum=1- excludeCurrentUser=false- )+ id="search-posted-by"+ value=searchedTerms.username+ onChange=(action "onChangeSearchTermForUsername")+ options=(hash+ headerAriaLabel=(i18n "search.advanced.posted_by.aria_label")+ maximum=1+ excludeCurrentUser=false+ )}}</div></div>@@ -156,6 +161,9 @@content=postTimeOptionsvalue=searchedTerms.time.whenonChange=(action "onChangeWhenTime")+ options=(hash+ headerAriaLabel=(i18n "search.advanced.post.time.aria_label")+ )}}{{date-inputdate=searchedTerms.time.daysdiff --git a/app/assets/javascripts/discourse/app/templates/components/search-result-entries.hbs b/app/assets/javascripts/discourse/app/templates/components/search-result-entries.hbsindex 55f3e6d2c49..ea93c26dbdd 100644--- a/app/assets/javascripts/discourse/app/templates/components/search-result-entries.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/search-result-entries.hbs@@ -1,4 +1,4 @@-<div class="fps-result-entries">+<div class="fps-result-entries" role="list">{{#each posts as |post|}}{{search-result-entry post=post bulkSelectEnabled=bulkSelectEnabled selected=selected highlightQuery=highlightQuery}}{{/each}}diff --git a/app/assets/javascripts/discourse/app/templates/components/search-result-entry.hbs b/app/assets/javascripts/discourse/app/templates/components/search-result-entry.hbsindex 0aa042f3dfe..488948b8a7f 100644--- a/app/assets/javascripts/discourse/app/templates/components/search-result-entry.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/search-result-entry.hbs@@ -10,7 +10,7 @@{{track-selected selectedList=selected selectedId=post.topic class="bulk-select"}}{{/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}}<span class="topic-title">{{#if post.useTopicTitleHeadline}}diff --git a/app/assets/javascripts/discourse/app/templates/full-page-search.hbs b/app/assets/javascripts/discourse/app/templates/full-page-search.hbsindex 8ebfa925886..62c43692ac2 100644--- a/app/assets/javascripts/discourse/app/templates/full-page-search.hbs+++ b/app/assets/javascripts/discourse/app/templates/full-page-search.hbs@@ -1,7 +1,7 @@{{#d-section pageClass="search" class="search-container"}}{{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">{{#if hasResults}}<div class="result-count" id="search-result-count" aria-live="polite">@@ -68,7 +68,7 @@<div class="search-advanced">{{#if hasResults}}{{#if usingDefaultSearchType}}- <div class={{searchInfoClassNames}}>+ <div class={{searchInfoClassNames}} role="region" ariaLabel={{i18n "search.sort_or_bulk_actions"}}>{{#if canBulkSelect}}{{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")}}@@ -89,6 +89,7 @@castInteger=trueonChange=(action (mut sortOrder))id="search-sort-by"+ ariaLabel="Some label"}}</div></div>@@ -100,7 +101,7 @@{{#if searching}}{{loading-spinner size="medium"}}{{else}}- <div class="search-results">+ <div class="search-results" role="region">{{#load-more selector=".fps-result" action=(action "loadMore")}}{{#if usingDefaultSearchType}}{{search-result-entriesdiff --git a/app/assets/javascripts/select-kit/addon/components/multi-select/multi-select-header.js b/app/assets/javascripts/select-kit/addon/components/multi-select/multi-select-header.jsindex 72f200b4ba1..14ee8979d1c 100644--- a/app/assets/javascripts/select-kit/addon/components/multi-select/multi-select-header.js+++ b/app/assets/javascripts/select-kit/addon/components/multi-select/multi-select-header.js@@ -6,10 +6,12 @@ import { reads } from "@ember/object/computed";export default SelectKitHeaderComponent.extend({tagName: "summary",classNames: ["multi-select-header"],+ attributeBindings: ["ariaLabel:aria-label"],layout,caretUpIcon: reads("selectKit.options.caretUpIcon"),caretDownIcon: reads("selectKit.options.caretDownIcon"),+ ariaLabel: reads("selectKit.options.headerAriaLabel"),caretIcon: computed("selectKit.isExpanded","caretUpIcon",diff --git a/app/assets/javascripts/select-kit/addon/components/select-kit/single-select-header.js b/app/assets/javascripts/select-kit/addon/components/select-kit/single-select-header.jsindex 8178544d759..141623faac8 100644--- a/app/assets/javascripts/select-kit/addon/components/select-kit/single-select-header.js+++ b/app/assets/javascripts/select-kit/addon/components/select-kit/single-select-header.js@@ -1,4 +1,5 @@import { computed } from "@ember/object";+import { or } from "@ember/object/computed";import SelectKitHeaderComponent from "select-kit/components/select-kit/select-kit-header";import UtilsMixin from "select-kit/mixins/utils";import layout from "select-kit/templates/components/select-kit/single-select-header";@@ -8,7 +9,9 @@ export default SelectKitHeaderComponent.extend(UtilsMixin, {tagName: "summary",layout,classNames: ["single-select-header"],- attributeBindings: ["name", "name:aria-label"],+ attributeBindings: ["name", "ariaLabel:aria-label"],++ ariaLabel: or("selectKit.options.headerAriaLabel", "name"),focusIn(event) {event.stopImmediatePropagation();diff --git a/app/assets/javascripts/select-kit/addon/templates/components/topic-notifications-button.hbs b/app/assets/javascripts/select-kit/addon/templates/components/topic-notifications-button.hbsindex 0d809a6df4c..0d1e594fc18 100644--- a/app/assets/javascripts/select-kit/addon/templates/components/topic-notifications-button.hbs+++ b/app/assets/javascripts/select-kit/addon/templates/components/topic-notifications-button.hbs@@ -8,6 +8,7 @@icon=iconshowFullTitle=showFullTitleshowCaret=showCaret+ headerAriaLabel=(i18n "topic.notifications.title"))}}<span class="text">{{html-safe notificationReasonText}}</span>@@ -21,6 +22,7 @@icon=iconshowFullTitle=showFullTitleshowCaret=showCaret+ headerAriaLabel=(i18n "topic.notifications.title"))}}{{/if}}diff --git a/config/locales/client.en.yml b/config/locales/client.en.ymlindex 8976053a692..9885897d793 100644--- a/config/locales/client.en.yml+++ b/config/locales/client.en.yml@@ -2335,6 +2335,7 @@ en:select_all: "Select All"clear_all: "Clear All"too_short: "Your search term is too short."+ sort_or_bulk_actions: "Sort or bulk select results"result_count:one: "<span>%{count} result 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 filtersposted_by:label: Posted by+ aria_label: Filter by post authorin_category:label: Categorizedin_group:@@ -2379,6 +2381,7 @@ en:label: With Badgewith_tags:label: Tagged+ aria_label: Filter using tagsfilters:label: Only return topics/posts...title: Matching in title only@@ -2413,6 +2416,7 @@ en:placeholder: maximumtime:label: Posted+ aria_label: Filter by posted datebefore: beforeafter: afterviews: