Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix(nc-gui): focus expanded form modal on alt + s so that esc works properly after save

Ramesh Mane9074983daf10
diff --git a/packages/nc-gui/components/smartsheet/expanded-form/index.vue b/packages/nc-gui/components/smartsheet/expanded-form/index.vue
index 0a591f6c1a..aac84c25ef 100644
--- a/packages/nc-gui/components/smartsheet/expanded-form/index.vue
+++ b/packages/nc-gui/components/smartsheet/expanded-form/index.vue
@@ -475,6 +475,13 @@ useActiveKeydownListener(
// remove focus from the active input if any
;(document.activeElement as HTMLElement)?.blur()
+ const modalFocusEl = wrapper.value?.closest('.ant-modal-wrap.nc-modal-wrapper, .ant-drawer.nc-drawer-expanded-form')
+
+ // Focus on the modal or drawer if it exists so that onEsc key can close the modal or drawer
+ if (modalFocusEl) {
+ modalFocusEl.focus?.()
+ }
+
e.stopPropagation()
if (!isAllowedAddNewRecord.value && isNew.value) {