From f7e90770da00b361d3616c3311bfc25851e5ac6b Mon Sep 17 00:00:00 2001 From: Keegan George Date: Mon, 2 Dec 2024 09:55:44 -0800 Subject: [PATCH] UX: `no-text` style being incorrectly added to tag suggester 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 7cf021ad6..bbf101606 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 e95728fa2..7cf4518b0 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; + } } }