Skip to content

A platform for community discussion. Free, open, simple.

A11Y: Fix several minor issues (#14436)

Penar Musaraj9235e2ad5d4e
diff --git a/app/assets/javascripts/discourse/app/helpers/topic-link.js b/app/assets/javascripts/discourse/app/helpers/topic-link.js
index 6dbcb1c18c3..24aa876896a 100644
--- a/app/assets/javascripts/discourse/app/helpers/topic-link.js
+++ b/app/assets/javascripts/discourse/app/helpers/topic-link.js
@@ -17,7 +17,7 @@ registerUnbound("topic-link", (topic, args) => {
return htmlSafe(
`<a href='${url}'
role='heading'
- level='2'
+ aria-level='2'
class='${classes.join(" ")}'
data-topic-id='${topic.id}'>${title}</a>`
);
diff --git a/app/assets/javascripts/discourse/app/raw-views/topic-list-header-column.js b/app/assets/javascripts/discourse/app/raw-views/topic-list-header-column.js
index 379799fb6f8..d3d32034547 100644
--- a/app/assets/javascripts/discourse/app/raw-views/topic-list-header-column.js
+++ b/app/assets/javascripts/discourse/app/raw-views/topic-list-header-column.js
@@ -55,7 +55,7 @@ export default EmberObject.extend({
if (this.isSorting) {
return this.parent.ascending ? "ascending" : "descending";
} else {
- return "none";
+ return false;
}
},
});
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.hbs
index 488948b8a7f..fda4ae08bf6 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" role="heading">
+ <a href={{post.url}} {{action "logClick" post.topic_id}} class="search-link" role="heading" aria-level="2">
{{raw "topic-status" topic=post.topic showPrivateMessageIcon=true}}
<span class="topic-title">
{{#if post.useTopicTitleHeadline}}
diff --git a/app/assets/javascripts/discourse/app/widgets/header-contents.js b/app/assets/javascripts/discourse/app/widgets/header-contents.js
index e0ce80ebc15..5ce69e3b2d5 100644
--- a/app/assets/javascripts/discourse/app/widgets/header-contents.js
+++ b/app/assets/javascripts/discourse/app/widgets/header-contents.js
@@ -8,6 +8,6 @@ createWidget("header-contents", {
{{#if attrs.topic}}
{{header-topic-info attrs=attrs}}
{{/if}}
- <div class="panel clearfix">{{yield}}</div>
+ <div class="panel clearfix" role="navigation">{{yield}}</div>
`,
});
diff --git a/app/assets/javascripts/discourse/app/widgets/header.js b/app/assets/javascripts/discourse/app/widgets/header.js
index bca43e1cec3..afe4821b3f1 100644
--- a/app/assets/javascripts/discourse/app/widgets/header.js
+++ b/app/assets/javascripts/discourse/app/widgets/header.js
@@ -213,10 +213,6 @@ createWidget(
createWidget("header-icons", {
tagName: "ul.icons.d-header-icons",
- buildAttributes() {
- return { role: "navigation" };
- },
-
html(attrs) {
if (this.siteSettings.login_required && !this.currentUser) {
return [];
diff --git a/app/assets/javascripts/select-kit/addon/components/period-chooser.js b/app/assets/javascripts/select-kit/addon/components/period-chooser.js
index c09c8708148..a9e792a5b50 100644
--- a/app/assets/javascripts/select-kit/addon/components/period-chooser.js
+++ b/app/assets/javascripts/select-kit/addon/components/period-chooser.js
@@ -1,5 +1,6 @@
import { oneWay, readOnly } from "@ember/object/computed";
import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box";
+import I18n from "I18n";
export default DropdownSelectBoxComponent.extend({
classNames: ["period-chooser"],
@@ -20,6 +21,7 @@ export default DropdownSelectBoxComponent.extend({
fullDay: "fullDay",
customStyle: true,
headerComponent: "period-chooser/period-chooser-header",
+ headerAriaLabel: I18n.t("period_chooser.aria_label"),
},
actions: {
diff --git a/app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-header.js b/app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-header.js
index effe39459b4..8b629488249 100644
--- a/app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-header.js
+++ b/app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-header.js
@@ -9,7 +9,6 @@ export default Component.extend(UtilsMixin, {
attributeBindings: [
"role",
"tabindex",
- "ariaLevel:aria-level",
"selectedValue:data-value",
"selectedNames:data-name",
"buttonTitle:title",
@@ -20,8 +19,6 @@ export default Component.extend(UtilsMixin, {
role: "listbox",
- ariaLevel: 1,
-
tabindex: 0,
selectedValue: computed("value", function () {
diff --git a/app/assets/javascripts/select-kit/addon/templates/components/period-chooser/period-chooser-header.hbs b/app/assets/javascripts/select-kit/addon/templates/components/period-chooser/period-chooser-header.hbs
index ae393d67c0c..67afe56607a 100644
--- a/app/assets/javascripts/select-kit/addon/templates/components/period-chooser/period-chooser-header.hbs
+++ b/app/assets/javascripts/select-kit/addon/templates/components/period-chooser/period-chooser-header.hbs
@@ -1,4 +1,4 @@
-<h2 class="selected-name" title={{title}}>
+<h2 class="selected-name" title={{title}} role="option">
{{period-title value
showDateRange=true
fullDay=selectKit.options.fullDay
diff --git a/app/assets/javascripts/select-kit/addon/templates/components/selected-name.hbs b/app/assets/javascripts/select-kit/addon/templates/components/selected-name.hbs
index ec8683ff608..ef6c82086bf 100644
--- a/app/assets/javascripts/select-kit/addon/templates/components/selected-name.hbs
+++ b/app/assets/javascripts/select-kit/addon/templates/components/selected-name.hbs
@@ -1,5 +1,5 @@
{{#if selectKit.options.showFullTitle}}
- <div lang={{lang}} title={{title}} data-value={{value}} data-name={{name}} class="select-kit-selected-name selected-name choice">
+ <div lang={{lang}} title={{title}} data-value={{value}} data-name={{name}} role="option" class="select-kit-selected-name selected-name choice">
{{#if item.icon}}
{{d-icon item.icon}}
{{/if}}
@@ -20,7 +20,7 @@
</div>
{{else}}
{{#if item.icon}}
- <div role="textbox" lang={{lang}} class="select-kit-selected-name selected-name choice">
+ <div role="option" lang={{lang}} class="select-kit-selected-name selected-name choice">
{{d-icon item.icon}}
</div>
{{/if}}
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 877d3b095cd..ce349661ad6 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -267,6 +267,8 @@ en:
character_count:
one: "%{count} character"
other: "%{count} characters"
+ period_chooser:
+ aria_label: "Filter by period"
related_messages:
title: "Related Messages"