UX: remove `aria-label` for buttons when `title` attribute exists. (#14529)

UX: remove aria-label for buttons when title attribute exists. (#14529)

Both aria-label and title have the same value and NVDA reading both the texts while navigating between buttons. NVDA already has an open issue 'title' attribute value should not be read when 'aria-label' is available in [Chrome] and [Firefox] · Issue #7841 · nvaccess/nvda · GitHub. We’re removing aria-label until they fix it.

diff --git a/app/assets/javascripts/discourse/app/widgets/button.js b/app/assets/javascripts/discourse/app/widgets/button.js
index 6b08400..29f071f 100644
--- a/app/assets/javascripts/discourse/app/widgets/button.js
+++ b/app/assets/javascripts/discourse/app/widgets/button.js
@@ -38,7 +38,6 @@ export const ButtonClass = {
     }
 
     if (title) {
-      attributes["aria-label"] = title;
       attributes.title = title;
     }
 
diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/button-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/button-test.js
index c8b5bf9..1e08782 100644
--- a/app/assets/javascripts/discourse/tests/integration/widgets/button-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/widgets/button-test.js
@@ -75,7 +75,6 @@ discourseModule("Integration | Component | Widget | button", function (hooks) {
 
     test(assert) {
       assert.equal(query("button").title, "foo bar");
-      assert.equal(query("button").getAttribute("aria-label"), "foo bar");
     },
   });
 });

GitHub sha: 1b99f99ff731ce9b9154223744e6a72c8016a8d6

This commit appears in #14529 which was approved by pmusaraj. It was merged by vinothkannans.