From 50ad5415ffa17e65e879449ab3997619e4c4d292 Mon Sep 17 00:00:00 2001 From: Keegan George Date: Tue, 3 Dec 2024 03:11:04 +0900 Subject: [PATCH] UX: `no-text` style being incorrectly added to tag suggester (#987) In the tag suggester menu we use `DButton` as a wrapper element and use the `discourseTag` helper to render the text inside the element. So visually there is text content inside the button. However, since `DButton` assumes that no `label`/`translatedLabel` inside an element means `.no-text` CSS style should be applied to the button's element, it was resulting in some incorrect styling being applied to this menu. This PR resolves that by programmatically adding the tag as a `translatedLabel` and then visually hiding it with CSS. --- .../components/suggestion-menus/ai-tag-suggester.gjs | 1 + assets/stylesheets/modules/ai-helper/common/ai-helper.scss | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/assets/javascripts/discourse/components/suggestion-menus/ai-tag-suggester.gjs b/assets/javascripts/discourse/components/suggestion-menus/ai-tag-suggester.gjs index 7cf021ad..bbf10160 100644 --- a/assets/javascripts/discourse/components/suggestion-menus/ai-tag-suggester.gjs +++ b/assets/javascripts/discourse/components/suggestion-menus/ai-tag-suggester.gjs @@ -198,6 +198,7 @@ export default class AiTagSuggester extends Component { data-name={{suggestion.name}} data-value={{index}} title={{suggestion.name}} + @translatedLabel={{suggestion.name}} @disabled={{this.isDisabled suggestion}} @action={{fn this.applySuggestion suggestion}} > diff --git a/assets/stylesheets/modules/ai-helper/common/ai-helper.scss b/assets/stylesheets/modules/ai-helper/common/ai-helper.scss index e95728fa..7cf4518b 100644 --- a/assets/stylesheets/modules/ai-helper/common/ai-helper.scss +++ b/assets/stylesheets/modules/ai-helper/common/ai-helper.scss @@ -266,6 +266,10 @@ .discourse-tag-count { margin-left: 5px; } + + .d-button-label { + display: none; + } } }