Skip to content

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

DEV: Add a default options arg to `closeOnClickOutside` (#35603)

Jarek Radosz47559c86f558
diff --git a/frontend/discourse/app/modifiers/close-on-click-outside.js b/frontend/discourse/app/modifiers/close-on-click-outside.js
index c68ad9dcac5..7fbafd31b64 100644
--- a/frontend/discourse/app/modifiers/close-on-click-outside.js
+++ b/frontend/discourse/app/modifiers/close-on-click-outside.js
@@ -10,7 +10,7 @@ export default class CloseOnClickOutside extends Modifier {
modify(
element,
- [closeFn, { targetSelector, secondaryTargetSelector, target }]
+ [closeFn, { targetSelector, secondaryTargetSelector, target } = {}]
) {
this.closeFn = closeFn;
this.element = element;
diff --git a/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-actions.gjs b/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-actions.gjs
index b413bc7715b..5beec62f85e 100644
--- a/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-actions.gjs
+++ b/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-actions.gjs
@@ -745,7 +745,7 @@ export default class DiscourseReactionsActions extends Component {
{{on "touchstart" this.touchStart}}
{{on "touchmove" this.touchMove}}
{{on "touchend" this.touchEnd}}
- {{closeOnClickOutside this.clickOutside (hash)}}
+ {{closeOnClickOutside this.clickOutside}}
>
{{#let
(hash
diff --git a/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-counter.gjs b/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-counter.gjs
index 2351a0c0c8b..a5f845ae048 100644
--- a/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-counter.gjs
+++ b/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-counter.gjs
@@ -1,5 +1,4 @@
import Component from "@glimmer/component";
-import { hash } from "@ember/helper";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
@@ -174,7 +173,7 @@ export default class DiscourseReactionsCounter extends Component {
class={{this.classes}}
{{on "mousedown" this.mouseDown}}
{{on "mouseup" this.mouseUp}}
- {{closeOnClickOutside this.clickOutside (hash)}}
+ {{closeOnClickOutside this.clickOutside}}
{{on "touchstart" this.touchStart}}
{{on "pointerover" this.pointerOver}}
{{on "pointerout" this.pointerOut}}
diff --git a/plugins/discourse-topic-voting/assets/javascripts/discourse/components/vote-box.gjs b/plugins/discourse-topic-voting/assets/javascripts/discourse/components/vote-box.gjs
index 1387b54fe90..fb02ef475e8 100644
--- a/plugins/discourse-topic-voting/assets/javascripts/discourse/components/vote-box.gjs
+++ b/plugins/discourse-topic-voting/assets/javascripts/discourse/components/vote-box.gjs
@@ -1,6 +1,5 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
-import { hash } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
import { htmlSafe } from "@ember/template";
@@ -100,14 +99,14 @@ export default class VoteBox extends Component {
<VoteOptions
@topic={{@topic}}
@removeVote={{this.removeVote}}
- {{closeOnClickOutside this.closeVoteOptions (hash)}}
+ {{closeOnClickOutside this.closeVoteOptions}}
/>
{{/if}}
{{#if this.votesAlert}}
<div
class="voting-popup-menu vote-options popup-menu"
- {{closeOnClickOutside this.closeVotesAlert (hash)}}
+ {{closeOnClickOutside this.closeVotesAlert}}
>
{{htmlSafe
(i18n