From a0994ef827b0dd50518167d47fda2f5e440ee5e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Fri, 20 Oct 2023 10:18:00 +0200 Subject: [PATCH] fix: Avoid closing all modals on escape if multiple are present MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- src/components/NcModal/NcModal.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/NcModal/NcModal.vue b/src/components/NcModal/NcModal.vue index 5d639b7a7c..2b7812d56d 100644 --- a/src/components/NcModal/NcModal.vue +++ b/src/components/NcModal/NcModal.vue @@ -668,6 +668,11 @@ export default { */ handleKeydown(event) { if (event.key === 'Escape') { + const trapStack = getTrapStack() + // Only close the most recent focus trap modal + if (trapStack.length > 0 && trapStack[trapStack.length - 1] !== this.focusTrap) { + return + } return this.close(event) }