Skip to content

Commit c359259

Browse files
committed
fix TimeRangeSelector dropdown behaviour when clicking after other input was focused before
1 parent 55d12aa commit c359259

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

resources/js/packages/ui/src/TimeTracker/TimeTrackerRangeSelector.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,21 @@ const inputField = ref<HTMLInputElement | null>(null);
9696
const timeRangeSelector = ref<HTMLElement | null>(null);
9797
9898
function openModalOnTab(e: FocusEvent) {
99+
pauseLiveTimerUpdate(e);
100+
99101
// check if the source is inside the dropdown
100102
const source = e.relatedTarget as HTMLElement;
101103
if (source && window.document.body.querySelector<HTMLElement>('#app')?.contains(source)) {
102104
open.value = true;
103105
}
104106
}
105107
108+
function openModalOnClick(e: MouseEvent) {
109+
pauseLiveTimerUpdate(e);
110+
111+
open.value = true;
112+
}
113+
106114
function focusNextElement(e: KeyboardEvent) {
107115
if (open.value) {
108116
e.preventDefault();
@@ -135,8 +143,8 @@ function closeAndFocusInput() {
135143
data-testid="time_entry_time"
136144
class="w-[110px] lg:w-[130px] h-full text-text-primary py-2.5 rounded-lg border-border-secondary border text-center px-4 text-base lg:text-lg font-semibold bg-card-background border-none placeholder-muted focus:ring-0 transition"
137145
type="text"
138-
@focus="pauseLiveTimerUpdate"
139146
@focusin="openModalOnTab"
147+
@click="openModalOnClick"
140148
@keydown.exact.tab="focusNextElement"
141149
@keydown.exact.shift.tab="open = false"
142150
@blur="updateTimerAndStartLiveTimerUpdate"

0 commit comments

Comments
 (0)