mirror of
https://github.com/discourse/discourse.git
synced 2025-04-01 06:21:40 +08:00
UX: Don't default title to label text for buttons.
This commit is contained in:
parent
90c0198a57
commit
08d68e846c
@ -6,7 +6,7 @@ export default Ember.Component.extend({
|
||||
|
||||
tagName: 'button',
|
||||
classNameBindings: [':btn', 'noText', 'btnType'],
|
||||
attributeBindings: ['disabled', 'translatedTitle:title', 'tabindex'],
|
||||
attributeBindings: ['disabled', 'translatedTitle:title', 'ariaLabel:aria-label', 'tabindex'],
|
||||
|
||||
btnIcon: Ember.computed.notEmpty('icon'),
|
||||
|
||||
@ -23,7 +23,7 @@ export default Ember.Component.extend({
|
||||
|
||||
@computed("title")
|
||||
translatedTitle(title) {
|
||||
return title ? I18n.t(title) : this.get('translatedLabel');
|
||||
if (title) return I18n.t(title);
|
||||
},
|
||||
|
||||
@computed("label")
|
||||
@ -31,6 +31,11 @@ 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;
|
||||
|
@ -32,11 +32,14 @@ export const ButtonClass = {
|
||||
let title;
|
||||
if (attrs.title) {
|
||||
title = I18n.t(attrs.title, attrs.titleOptions);
|
||||
} else if (attrs.label) {
|
||||
title = I18n.t(attrs.label, attrs.labelOptions);
|
||||
}
|
||||
|
||||
const attributes = { "aria-label": 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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user