From 343cacf5cce8e993d144c9da690463c2d9726b58 Mon Sep 17 00:00:00 2001 From: qiang Date: Thu, 14 Nov 2024 21:14:51 +0800 Subject: [PATCH] fix(components): numpadEnter does not work like the Enter (#18855) --- .../vitepress/components/vp-app.vue | 3 +- .../vitepress/components/vp-demo.vue | 7 +- .../components/cascader-panel/src/index.vue | 1 + packages/components/cascader/src/cascader.vue | 2 + .../color-picker/src/color-picker.vue | 1 + .../dropdown/src/dropdown-item-impl.vue | 7 +- packages/components/dropdown/src/dropdown.vue | 7 +- .../components/dropdown/src/useDropdown.ts | 2 +- .../focus-trap/__tests__/focus-trap.test.ts | 28 ++--- .../components/focus-trap/src/focus-trap.vue | 4 +- packages/components/mention/src/mention.vue | 103 ++++++++++-------- .../components/menu/src/utils/menu-item.ts | 1 + packages/components/menu/src/utils/submenu.ts | 1 + .../__tests__/roving-focus-item.test.ts | 10 +- .../roving-focus-group/__tests__/util.test.ts | 14 +-- .../src/roving-focus-item.vue | 4 +- .../roving-focus-group/src/utils.ts | 2 +- .../select-v2/src/select-dropdown.tsx | 15 +-- .../slider/__tests__/slider.test.tsx | 18 +-- .../src/composables/use-slider-button.ts | 42 ++++--- packages/components/tabs/src/tab-nav.tsx | 58 +++++----- packages/components/tabs/src/tabs.tsx | 3 +- packages/components/tooltip/src/trigger.ts | 2 +- .../components/tree/src/model/useKeydown.ts | 7 +- packages/hooks/use-escape-keydown/index.ts | 5 +- 25 files changed, 194 insertions(+), 153 deletions(-) diff --git a/docs/.vitepress/vitepress/components/vp-app.vue b/docs/.vitepress/vitepress/components/vp-app.vue index 6252d1b0a7..f2e6235b4a 100644 --- a/docs/.vitepress/vitepress/components/vp-app.vue +++ b/docs/.vitepress/vitepress/components/vp-app.vue @@ -4,6 +4,7 @@ import { onMounted } from 'vue' import nprogress from 'nprogress' // import dayjs from 'dayjs' import { isClient, useEventListener, useToggle } from '@vueuse/core' +import { EVENT_CODE } from 'element-plus' import { useSidebar } from '../composables/sidebar' import { useToggleWidgets } from '../composables/toggle-widgets' // import { useLang } from '../composables/lang' @@ -36,7 +37,7 @@ useToggleWidgets(isSidebarOpen, () => { useEventListener('keydown', (e) => { if (!isClient) return - if (e.key === 'Escape' && isSidebarOpen.value) { + if (e.code === EVENT_CODE.esc && isSidebarOpen.value) { toggleSidebar(false) document.querySelector('.sidebar-button')?.focus() } diff --git a/docs/.vitepress/vitepress/components/vp-demo.vue b/docs/.vitepress/vitepress/components/vp-demo.vue index 3dc3a2157a..fe43126958 100644 --- a/docs/.vitepress/vitepress/components/vp-demo.vue +++ b/docs/.vitepress/vitepress/components/vp-demo.vue @@ -1,6 +1,7 @@