Skip to content

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

FIX: prevents d-menu trigger/untrigger propagation (#32078)

Joffrey JAFFEUXd12e0eb65d23
diff --git a/app/assets/javascripts/discourse/app/components/notifications-tracking.gjs b/app/assets/javascripts/discourse/app/components/notifications-tracking.gjs
index 3d77cca409b..21bc459cfd6 100644
--- a/app/assets/javascripts/discourse/app/components/notifications-tracking.gjs
+++ b/app/assets/javascripts/discourse/app/components/notifications-tracking.gjs
@@ -113,6 +113,7 @@ export default class NotificationsTracking extends Component {
"notifications-tracking-trigger-btn"
@triggerClass
}}
+ @contentClass={{@contentClass}}
@onRegisterApi={{this.registerDmenuApi}}
@title={{@title}}
@autofocus={{false}}
diff --git a/app/assets/javascripts/discourse/app/components/topic-notifications-tracking.gjs b/app/assets/javascripts/discourse/app/components/topic-notifications-tracking.gjs
index de4bb4e1dcc..6aacd3ccce6 100644
--- a/app/assets/javascripts/discourse/app/components/topic-notifications-tracking.gjs
+++ b/app/assets/javascripts/discourse/app/components/topic-notifications-tracking.gjs
@@ -19,6 +19,7 @@ export default class TopicNotificationsTracking extends Component {
class="topic-notifications-tracking"
@levels={{topicLevels}}
@suffix={{this.suffix}}
+ @contentClass={{@contentClass}}
/>
</template>
}
diff --git a/app/assets/javascripts/discourse/app/components/topic-timeline/container.gjs b/app/assets/javascripts/discourse/app/components/topic-timeline/container.gjs
index 5b5f92a56c6..315f0bffe72 100644
--- a/app/assets/javascripts/discourse/app/components/topic-timeline/container.gjs
+++ b/app/assets/javascripts/discourse/app/components/topic-timeline/container.gjs
@@ -669,7 +669,11 @@ export default class TopicTimelineScrollArea extends Component {
{{/if}}
{{#if (and this.currentUser this.site.desktopView)}}
- <TopicNotificationsButton @topic={{@model}} @expanded={{false}} />
+ <TopicNotificationsButton
+ @contentClass="topic-timeline-notifications-tracking-content"
+ @topic={{@model}}
+ @expanded={{false}}
+ />
{{/if}}
<PluginOutlet
diff --git a/app/assets/javascripts/float-kit/addon/lib/d-menu-instance.js b/app/assets/javascripts/float-kit/addon/lib/d-menu-instance.js
index 23eeaf01ce4..59e5e93773f 100644
--- a/app/assets/javascripts/float-kit/addon/lib/d-menu-instance.js
+++ b/app/assets/javascripts/float-kit/addon/lib/d-menu-instance.js
@@ -110,13 +110,17 @@ export default class DMenuInstance extends FloatKitInstance {
}
@action
- async onTrigger() {
+ async onTrigger(event) {
+ event.stopPropagation();
+
await this.options.beforeTrigger?.(this);
await this.show();
}
@action
- async onUntrigger() {
+ async onUntrigger(event) {
+ event.stopPropagation();
+
await this.close();
}
diff --git a/app/assets/javascripts/select-kit/addon/components/topic-notifications-button.gjs b/app/assets/javascripts/select-kit/addon/components/topic-notifications-button.gjs
index 65b1ce72410..8c118d73a1f 100644
--- a/app/assets/javascripts/select-kit/addon/components/topic-notifications-button.gjs
+++ b/app/assets/javascripts/select-kit/addon/components/topic-notifications-button.gjs
@@ -122,6 +122,7 @@ export default class TopicNotificationsButton extends Component {
@showFullTitle={{@expanded}}
@showCaret={{@expanded}}
@topic={{@topic}}
+ @contentClass={{@contentClass}}
/>
{{#if @expanded}}
diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss
index 1ae638a0fac..cd8f28af1c5 100644
--- a/app/assets/stylesheets/common.scss
+++ b/app/assets/stylesheets/common.scss
@@ -6,6 +6,8 @@
@import "common/whcm";
@import "common/foundation/helpers";
@import "common/foundation/base";
+@import "common/form-kit/_index";
+@import "common/float-kit/_index";
@import "common/select-kit/_index";
@import "common/components/_index";
@import "common/modal/_index";
@@ -17,9 +19,7 @@
@import "common/software-update-prompt";
@import "common/topic-timeline";
@import "common/loading-slider";
-@import "common/float-kit/_index";
@import "common/rich-editor";
@import "common/login/_index";
@import "common/table-builder/_index";
@import "common/post-action-feedback";
-@import "common/form-kit/_index";
diff --git a/app/assets/stylesheets/common/components/notifications-tracking.scss b/app/assets/stylesheets/common/components/notifications-tracking.scss
index 46563b1e977..3e7ce0f839a 100644
--- a/app/assets/stylesheets/common/components/notifications-tracking.scss
+++ b/app/assets/stylesheets/common/components/notifications-tracking.scss
@@ -37,3 +37,7 @@
text-align: left;
}
}
+
+.topic-timeline-notifications-tracking-content {
+ z-index: z("fullscreen") + 1;
+}