fix that timetracker duration popover instantly closes on click if another element was focused before

This commit is contained in:
Gregor Vostrak
2025-05-20 16:06:00 +02:00
parent 4635fec016
commit 915204f7a6

View File

@@ -101,15 +101,19 @@ const startTime = computed(() => {
const inputField = ref<HTMLInputElement | null>(null); const inputField = ref<HTMLInputElement | null>(null);
const timeRangeSelector = ref<HTMLElement | null>(null); const timeRangeSelector = ref<HTMLElement | null>(null);
const isMouseDown = ref(false);
function openModalOnTab(e: FocusEvent) { function openModalOnTab(e: FocusEvent) {
// check if the source is inside the dropdown // check if the source is inside the dropdown
console.log(e.target);
const source = e.relatedTarget as HTMLElement; const source = e.relatedTarget as HTMLElement;
if ( if (
source && source &&
window.document.body window.document.body
.querySelector<HTMLElement>('#app') .querySelector<HTMLElement>('#app')
?.contains(source) ?.contains(source) &&
!isMouseDown.value
) { ) {
open.value = true; open.value = true;
} }
@@ -153,6 +157,8 @@ function closeAndFocusInput() {
@keydown.exact.tab="focusNextElement" @keydown.exact.tab="focusNextElement"
@keydown.exact.shift.tab="open = false" @keydown.exact.shift.tab="open = false"
@blur="updateTimerAndStartLiveTimerUpdate" @blur="updateTimerAndStartLiveTimerUpdate"
@mousedown="isMouseDown = true"
@mouseup="isMouseDown = false"
@keydown.enter="onTimeEntryEnterPress" /> @keydown.enter="onTimeEntryEnterPress" />
</template> </template>
<template #content> <template #content>