FIX: Return proper aria-labels (#237)

FIX: Return proper aria-labels (#237)

  • Add proper aria label to dropdown
  • Make sure footer button aria-labels are returned

fixes : Discourse Dev

diff --git a/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js.es6 b/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js.es6
index 5268544..01916ac 100644
--- a/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js.es6
+++ b/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js.es6
@@ -105,7 +105,8 @@ function registerTopicFooterButtons(api) {
       if (user) {
         return {
           id: null,
-          name: htmlSafe(
+          name: I18n.t("discourse_assign.reassign_modal.title"),
+          label: htmlSafe(
             `${renderAvatar(user, {
               imageSize: "tiny",
               ignoreTitle: true,
@@ -115,7 +116,8 @@ function registerTopicFooterButtons(api) {
       } else if (group) {
         return {
           id: null,
-          name: htmlSafe(
+          name: I18n.t("discourse_assign.reassign_modal.title"),
+          label: htmlSafe(
             `<span class="unassign-label">${groupLabel}</span> @${group.name}...`
           ),
         };
@@ -160,10 +162,10 @@ function registerTopicFooterButtons(api) {
     },
     priority: 250,
     translatedTitle() {
-      defaultTitle(this);
+      return defaultTitle(this);
     },
     translatedAriaLabel() {
-      defaultTitle(this);
+      return defaultTitle(this);
     },
     translatedLabel() {
       return I18n.t("discourse_assign.assign.title");
@@ -204,10 +206,10 @@ function registerTopicFooterButtons(api) {
   api.registerTopicFooterButton({
     id: "unassign-mobile-header",
     translatedTitle() {
-      defaultTitle(this);
+      return defaultTitle(this);
     },
     translatedAriaLabel() {
-      defaultTitle(this);
+      return defaultTitle(this);
     },
     translatedLabel() {
       const user = this.get("topic.assigned_to_user");
@@ -246,10 +248,10 @@ function registerTopicFooterButtons(api) {
       return "user-times";
     },
     translatedTitle() {
-      defaultTitle(this);
+      return defaultTitle(this);
     },
     translatedAriaLabel() {
-      defaultTitle(this);
+      return defaultTitle(this);
     },
     translatedLabel() {
       const label = I18n.t("discourse_assign.unassign.title");
@@ -290,10 +292,10 @@ function registerTopicFooterButtons(api) {
       return "user-plus";
     },
     translatedTitle() {
-      defaultTitle(this);
+      return defaultTitle(this);
     },
     translatedAriaLabel() {
-      defaultTitle(this);
+      return defaultTitle(this);
     },
     translatedLabel() {
       const label = I18n.t("discourse_assign.reassign.to_self");
@@ -339,10 +341,10 @@ function registerTopicFooterButtons(api) {
       return "user-plus";
     },
     translatedTitle() {
-      defaultTitle(this);
+      return defaultTitle(this);
     },
     translatedAriaLabel() {
-      defaultTitle(this);
+      return defaultTitle(this);
     },
     translatedLabel() {
       const label = I18n.t("discourse_assign.reassign.title_w_ellipsis");

GitHub sha: ec9405df5c2445bb701c420f3f45f2e3da7b9f1c

This commit appears in #237 which was approved by blake. It was merged by janzenisaac.