Skip to content

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

No need to default `aria-label` to label.

Guo Xiang Tan8bc5da57b09d
diff --git a/app/assets/javascripts/discourse/components/d-button.js.es6 b/app/assets/javascripts/discourse/components/d-button.js.es6
index 13e36edc717..464a434bf11 100644
--- a/app/assets/javascripts/discourse/components/d-button.js.es6
+++ b/app/assets/javascripts/discourse/components/d-button.js.es6
@@ -6,7 +6,7 @@ export default Ember.Component.extend({
tagName: 'button',
classNameBindings: [':btn', 'noText', 'btnType'],
- attributeBindings: ['disabled', 'translatedTitle:title', 'ariaLabel:aria-label', 'tabindex'],
+ attributeBindings: ['disabled', 'translatedTitle:title', 'translatedTitle:aria-label', 'tabindex'],
btnIcon: Ember.computed.notEmpty('icon'),
@@ -31,11 +31,6 @@ export default Ember.Component.extend({
if (label) return I18n.t(label);
},
- @computed("translatedTitle", "translatedLabel")
- ariaLabel(translatedTitle, translatedLabel) {
- return translatedTitle ? translatedTitle : translatedLabel;
- },
-
click() {
this.sendAction("action", this.get("actionParam"));
return false;
diff --git a/app/assets/javascripts/discourse/widgets/button.js.es6 b/app/assets/javascripts/discourse/widgets/button.js.es6
index b9b288676a2..1794c0ab857 100644
--- a/app/assets/javascripts/discourse/widgets/button.js.es6
+++ b/app/assets/javascripts/discourse/widgets/button.js.es6
@@ -28,18 +28,14 @@ export const ButtonClass = {
buildAttributes() {
const attrs = this.attrs;
+ const attributes = {};
- let title;
if (attrs.title) {
- title = I18n.t(attrs.title, attrs.titleOptions);
+ const title = I18n.t(attrs.title, attrs.titleOptions);
+ attributes["aria-label"] = title;
+ attributes.title = title;
}
- let label;
- if (attrs.label) {
- label = I18n.t(attrs.label, attrs.labelOptions);
- }
-
- const attributes = { "aria-label": label, title };
if (attrs.disabled) { attributes.disabled = "true"; }
if (attrs.data) {