FIX: prevents mobile DMenu modal to lock scroll (#26550)
The bug was due to the fact that the `<DModal />` is displayed inside a if block, when the condition was false to close the menu, the modal was just hidden without calling callbacks. The fix ensures we are correctly calling `modal.close()` before in this case.
This commit is contained in:
parent
62788c2af1
commit
bd7823cc70
|
@ -7,6 +7,8 @@ import FloatKitInstance from "float-kit/lib/float-kit-instance";
|
|||
|
||||
export default class DMenuInstance extends FloatKitInstance {
|
||||
@service menu;
|
||||
@service site;
|
||||
@service modal;
|
||||
|
||||
constructor(owner, trigger, options = {}) {
|
||||
super(...arguments);
|
||||
|
@ -18,6 +20,15 @@ export default class DMenuInstance extends FloatKitInstance {
|
|||
this.setupListeners();
|
||||
}
|
||||
|
||||
@action
|
||||
close() {
|
||||
if (this.site.mobileView && this.options.modalForMobile) {
|
||||
this.modal.close();
|
||||
}
|
||||
|
||||
super.close(...arguments);
|
||||
}
|
||||
|
||||
@action
|
||||
onMouseMove(event) {
|
||||
if (this.trigger.contains(event.target) && this.expanded) {
|
||||
|
|
|
@ -22,6 +22,8 @@ export default class DToastInstance {
|
|||
}
|
||||
|
||||
get isValidForView() {
|
||||
return this.options.views.includes(this.site.desktopView ? "desktop" : "mobile");
|
||||
return this.options.views.includes(
|
||||
this.site.desktopView ? "desktop" : "mobile"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue