Skip to content

Commit

Permalink
Fixed #14354
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
brandonkelly committed Feb 11, 2024
1 parent 6635cc6 commit 06da832
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Exception response data no longer includes an `error` key with the exception message. `message` should be used instead. ([#14346](https://github.com/craftcms/cms/pull/14346))
- Fixed a bug where read/write splitting was always getting disabled for GraphQL POST requests. ([#14324](https://github.com/craftcms/cms/issues/14324))
- Fixed an error that occurred when adding a new block to a Matrix field with an overridden handle. ([#14350](https://github.com/craftcms/cms/issues/14350))
- Fixed a bug where opening a disclosure menu wasn’t hiding others. ([#14354](https://github.com/craftcms/cms/issues/14354))

## 5.0.0-beta.1 - 2024-02-08

Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/garnish/dist/garnish.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/garnish/dist/garnish.js.map

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions src/web/assets/garnish/src/DisclosureMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,21 @@ export default Base.extend(
Craft.initUiElements(this.$container);
}
this.addDisclosureMenuEventListeners();

Garnish.DisclosureMenu.instances.push(this);
},

addDisclosureMenuEventListeners: function () {
this.addListener(this.$trigger, 'mousedown', (ev) => {
ev.stopPropagation();
ev.preventDefault();

// Let the other disclosure menus know about it, at least
for (const disclosureMenu of Garnish.DisclosureMenu.instances) {
if (disclosureMenu !== this) {
disclosureMenu.handleMousedown(ev);
}
}
});

this.addListener(this.$trigger, 'mouseup', (ev) => {
Expand Down Expand Up @@ -712,6 +721,11 @@ export default Base.extend(
*/
destroy: function () {
this.$trigger.removeData('trigger');

Garnish.DisclosureMenu.instances = Craft.Preview.instances.filter(
(o) => o !== this
);

this.base();
},

Expand Down Expand Up @@ -750,5 +764,10 @@ export default Base.extend(
defaults: {
windowSpacing: 5,
},

/**
* @type {Garnish.DisclosureMenu[]}
*/
instances: [],
}
);
12 changes: 12 additions & 0 deletions src/web/assets/garnish/src/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,10 @@ export default Base.extend(
this.resizeDragger.destroy();
}

Garnish.Modal.instances = Craft.Preview.instances.filter(
(o) => o !== this
);

this.base();
},
},
Expand All @@ -395,7 +399,15 @@ export default Base.extend(
triggerElement: null,
shadeClass: 'modal-shade',
},

/**
* @type {Garnish.Modal[]}
*/
instances: [],

/**
* @type {?Garnish.Modal}
*/
visibleModal: null,
}
);

0 comments on commit 06da832

Please sign in to comment.