mirror of
https://github.com/flarum/framework.git
synced 2024-11-25 06:43:57 +08:00
Fix opening modals from other modals. (#2263)
While seemingly correct, an onremove method in Modal that triggers animateHide is problematic, because if one modal is opened from another, the one currently open will be removed from the DOM, triggering animateHide, and closing the new modal. To compensate, an onupdate method now closes a modal if one is open but shouldn't be; this supports the functionality of the old method when the modal is closed not from the modal instance itself (e.g. app.modal.close()) This is not ideal, but necessary. We should consider eventually expanding the modal system to support showing multiple modals at the same time (stacked over each other). Then, we can move this back to individual modals.
This commit is contained in:
parent
1ff4076f2a
commit
5b157f0adb
|
@ -27,10 +27,6 @@ export default class Modal extends Component {
|
|||
this.attrs.onshow(() => this.onready());
|
||||
}
|
||||
|
||||
onremove() {
|
||||
this.attrs.onhide();
|
||||
}
|
||||
|
||||
view() {
|
||||
if (this.alertAttrs) {
|
||||
this.alertAttrs.dismissible = false;
|
||||
|
|
|
@ -16,6 +16,12 @@ export default class ModalManager extends Component {
|
|||
);
|
||||
}
|
||||
|
||||
onupdate() {
|
||||
if (this.$('.Modal') && !this.attrs.state.modal) {
|
||||
this.animateHide();
|
||||
}
|
||||
}
|
||||
|
||||
oncreate(vnode) {
|
||||
super.oncreate(vnode);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user