feat: escape should close single select, multi select picker and turn to select state

This commit is contained in:
Amit Joki
2025-02-17 13:11:45 +00:00
parent c6aefe1c0d
commit 968f9a446b
2 changed files with 14 additions and 0 deletions

View File

@@ -44,6 +44,7 @@ const isSurveyForm = inject(IsSurveyFormInj, ref(false))
const aselect = ref<typeof AntSelect>()
const isOpen = ref(false)
const canvasSelectCell = inject(CanvasSelectCellInj)
const isFocusing = ref(false)
@@ -137,6 +138,10 @@ useSelectedCellKeydownListener(
(e) => {
switch (e.key) {
case 'Escape':
if (canvasSelectCell) {
canvasSelectCell.trigger()
return
}
isOpen.value = false
break
case 'Enter':
@@ -328,6 +333,8 @@ onMounted(() => {
if (key && isSinglePrintableKey(key)) {
onFocus()
searchVal.value = key
} else if (key === 'Enter') {
onFocus()
}
})
}