From 3fc6fb8333deeed7531d27a080531bce2d27d4d1 Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Thu, 18 Jan 2024 16:39:20 +0500 Subject: [PATCH] add tabindex to history switch area in `MultipleViewList` Also added `keydown` events for tab accessibility --- .../History/CurrentHistory/HistoryPanel.vue | 2 +- .../History/Multiple/MultipleViewList.vue | 29 +++++++++++++++++-- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/client/src/components/History/CurrentHistory/HistoryPanel.vue b/client/src/components/History/CurrentHistory/HistoryPanel.vue index 264a66b2c289..467a83c94835 100644 --- a/client/src/components/History/CurrentHistory/HistoryPanel.vue +++ b/client/src/components/History/CurrentHistory/HistoryPanel.vue @@ -68,7 +68,7 @@ const props = defineProps({ }, isMultiViewItem: { type: Boolean, - default: false + default: false, }, }); diff --git a/client/src/components/History/Multiple/MultipleViewList.vue b/client/src/components/History/Multiple/MultipleViewList.vue index f32bb12449e3..3b31c5e20f97 100644 --- a/client/src/components/History/Multiple/MultipleViewList.vue +++ b/client/src/components/History/Multiple/MultipleViewList.vue @@ -32,6 +32,11 @@ const props = withDefaults( } ); +// defineEmits below +const emit = defineEmits<{ + (e: "update:show-modal", value: boolean): void; +}>(); + const scrollContainer: Ref = ref(null); const { arrived } = useAnimationFrameScroll(scrollContainer); @@ -99,9 +104,20 @@ async function onDrop(evt: any) { processingDrop.value = false; } } + +async function onKeyDown(evt: KeyboardEvent) { + if (evt.key === "Enter" || evt.key === " ") { + if ((evt.target as HTMLElement)?.classList?.contains("top-picker")) { + await createAndPin(); + } else if ((evt.target as HTMLElement)?.classList?.contains("bottom-picker")) { + emit("update:show-modal", true); + } + } +}