Skip to content

Commit 4c3ff53

Browse files
committed
Merge branch 'only-close-last-opened-modal-esc-key' into 'develop'
Only close the last opened modal when the esc key is pressed Closes baserow#3495 See merge request baserow/baserow!3795
2 parents d597dc9 + ee7586d commit 4c3ff53

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"type": "bug",
3+
"message": "Only close the last opened modal when the esc key is pressed.",
4+
"domain": "core",
5+
"issue_number": 3495,
6+
"bullet_points": [],
7+
"created_at": "2025-10-14"
8+
}

web-frontend/modules/core/components/Modal.vue

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,6 @@ export default {
158158
default: false,
159159
required: false,
160160
},
161-
canClose: {
162-
type: Boolean,
163-
default: true,
164-
required: false,
165-
},
166161
collapsibleRightSidebar: {
167162
type: Boolean,
168163
default: false,

web-frontend/modules/core/mixins/baseModal.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,16 @@ export default {
99
// when you release the mouse at different coordinates. Therefore we expect this
1010
// variable to be set on mousedown to be consistent.
1111
downElement: null,
12+
isModal: true,
1213
}
1314
},
15+
props: {
16+
canClose: {
17+
type: Boolean,
18+
default: true,
19+
required: false,
20+
},
21+
},
1422
mounted() {
1523
this.$bus.$on('close-modals', this.hide)
1624
},
@@ -68,6 +76,16 @@ export default {
6876
return
6977
}
7078

79+
const hasOpenModalAsChild = this.moveToBody.children.some((child) => {
80+
return child.isModal === true && child.open === true
81+
})
82+
// When the `esc` key is pressed and multiple modals are open, then we don't
83+
// want to close them all. Only last opened modal should close. This will make
84+
// sure that if there is an open child modal, it will not hide the parent modal.
85+
if (hasOpenModalAsChild) {
86+
return
87+
}
88+
7189
// This is a temporary fix. What happens is the modal is opened by a context menu
7290
// item and the user closes the modal, the element is first deleted and then the
7391
// click outside event of the context is fired. It then checks if the click was

0 commit comments

Comments
 (0)