Skip to content

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

UX: adds title attribute to widget dropdown header (#9597)

Joffrey JAFFEUX0d84f3afd4f7
diff --git a/app/assets/javascripts/discourse/app/widgets/widget-dropdown.js b/app/assets/javascripts/discourse/app/widgets/widget-dropdown.js
index 0b26f8d727d..dbb34a5e645 100644
--- a/app/assets/javascripts/discourse/app/widgets/widget-dropdown.js
+++ b/app/assets/javascripts/discourse/app/widgets/widget-dropdown.js
@@ -56,9 +56,11 @@ export const WidgetDropdownHeaderClass = {
tagName: "button",
transform(attrs) {
- return {
- label: attrs.translatedLabel ? attrs.translatedLabel : I18n.t(attrs.label)
- };
+ return { label: this._buildLabel(attrs) };
+ },
+
+ buildAttributes(attrs) {
+ return { title: this._buildLabel(attrs) };
},
buildClasses(attrs) {
@@ -85,7 +87,11 @@ export const WidgetDropdownHeaderClass = {
{{#if attrs.caret}}
{{d-icon "caret-down"}}
{{/if}}
- `
+ `,
+
+ _buildLabel(attrs) {
+ return attrs.translatedLabel ? attrs.translatedLabel : I18n.t(attrs.label);
+ }
};
createWidget("widget-dropdown-header", WidgetDropdownHeaderClass);