@@ -34,6 +34,7 @@ import { createYear, createYearRange, toDate } from 'reka-ui/date'
3434import { Select , SelectContent , SelectItem , SelectTrigger , SelectValue } from " @/components/ui/select" ;
3535import { Button } from " @/components/ui/button" ;
3636import { __ } from " @/utils/i18n" ;
37+ import { PopoverAnchor } from " reka-ui" ;
3738import { getDefaultDateLocale , getWeekStartsOn } from " @/utils/dates" ;
3839
3940const props = defineProps <FormFieldProps <FormDateFieldData >>();
@@ -159,13 +160,20 @@ function onMinuteChange(minute: string) {
159160 );
160161 }
161162}
163+
164+ function onInputClick(e : MouseEvent ) {
165+ if (! isTouch .value ) {
166+ open .value = true ;
167+ e .preventDefault ();
168+ }
169+ }
162170 </script >
163171
164172<template >
165173 <Popover v-model:open =" open" :modal =" false" >
166174 <FormFieldLayout v-bind =" props" v-slot =" { id, ariaDescribedBy }" >
167175 <div class =" relative" >
168- <PopoverTrigger as-child >
176+ <PopoverAnchor as-child >
169177 <Input
170178 :id =" id"
171179 class =" pl-10 min-w-full appearance-none text-left [& ::-webkit-calendar-picker-indicator]:hidden [& ::-webkit-date-and-time-value]:text-left"
@@ -181,10 +189,10 @@ function onMinuteChange(minute: string) {
181189 :model-value =" inputValue"
182190 @update:model-value =" onDateInput"
183191 @touchstart.passive =" isTouch = true"
184- @click.prevent = " open = !isTouch "
192+ @click = " onInputClick "
185193 ref =" input"
186194 />
187- </PopoverTrigger >
195+ </PopoverAnchor >
188196 <div class =" absolute right-px rounded-md top-px w-10 bottom-px bg-background hidden not-[@supports_selector(::-webkit-calendar-picker-indicator)]:block"
189197 @touchstart.passive =" isTouch = true"
190198 @click =" ($refs.input.$el as HTMLInputElement).focus(); open = !isTouch"
0 commit comments