From 62f04a05eecbc594faffe1e698454a1c6fa3a4f0 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Sun, 6 Nov 2022 12:22:38 +0530 Subject: [PATCH] fix(gui): prevent escape key press event bubbling only if picker is active Signed-off-by: Pranav C --- packages/nc-gui/components/cell/DatePicker.vue | 6 ++++-- packages/nc-gui/components/cell/DateTimePicker.vue | 6 ++++-- packages/nc-gui/components/cell/TimePicker.vue | 6 ++++-- packages/nc-gui/components/cell/YearPicker.vue | 6 ++++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/packages/nc-gui/components/cell/DatePicker.vue b/packages/nc-gui/components/cell/DatePicker.vue index 5e795d1b80..f4e6508bce 100644 --- a/packages/nc-gui/components/cell/DatePicker.vue +++ b/packages/nc-gui/components/cell/DatePicker.vue @@ -79,8 +79,10 @@ useSelectedCellKeyupListener(active, (e: KeyboardEvent) => { open.value = true break case 'Escape': - e.stopPropagation() - open.value = false + if (open.value) { + e.stopPropagation() + open.value = false + } break } }) diff --git a/packages/nc-gui/components/cell/DateTimePicker.vue b/packages/nc-gui/components/cell/DateTimePicker.vue index 9c4bb759bd..d9cb6e2dea 100644 --- a/packages/nc-gui/components/cell/DateTimePicker.vue +++ b/packages/nc-gui/components/cell/DateTimePicker.vue @@ -68,8 +68,10 @@ useSelectedCellKeyupListener(active, (e: KeyboardEvent) => { open.value = true break case 'Escape': - e.stopPropagation() - open.value = false + if (open.value) { + e.stopPropagation() + open.value = false + } break } }) diff --git a/packages/nc-gui/components/cell/TimePicker.vue b/packages/nc-gui/components/cell/TimePicker.vue index f9f319aa1e..6402de2bed 100644 --- a/packages/nc-gui/components/cell/TimePicker.vue +++ b/packages/nc-gui/components/cell/TimePicker.vue @@ -77,8 +77,10 @@ useSelectedCellKeyupListener(active, (e: KeyboardEvent) => { open.value = true break case 'Escape': - e.stopPropagation() - open.value = false + if (open.value) { + e.stopPropagation() + open.value = false + } break } }) diff --git a/packages/nc-gui/components/cell/YearPicker.vue b/packages/nc-gui/components/cell/YearPicker.vue index 197ee38e07..f1c3ef1bce 100644 --- a/packages/nc-gui/components/cell/YearPicker.vue +++ b/packages/nc-gui/components/cell/YearPicker.vue @@ -67,8 +67,10 @@ useSelectedCellKeyupListener(active, (e: KeyboardEvent) => { open.value = true break case 'Escape': - e.stopPropagation() - open.value = false + if (open.value) { + e.stopPropagation() + open.value = false + } break } })