Fix Firefox duplicate calendar icon with -moz-appearance: textfield
The opaque background overlay approach didn't fully cover Firefox's native icon. Instead, use @-moz-document url-prefix() to apply -moz-appearance: textfield which strips all native date input chrome (including the calendar icon) in Firefox. Safe because the DatePicker provides its own custom popup. Removed the bg-background z-[1] workaround from the custom button. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e9d4ba384f
commit
01aed12769
@ -464,7 +464,7 @@ const DatePicker = React.forwardRef<HTMLButtonElement, DatePickerProps>(
|
||||
disabled={disabled}
|
||||
onMouseDown={(e) => e.preventDefault()}
|
||||
onClick={togglePopup}
|
||||
className="absolute right-2.5 top-1/2 -translate-y-1/2 rounded p-0.5 bg-background hover:bg-accent/10 transition-colors disabled:opacity-50 z-[1]"
|
||||
className="absolute right-2.5 top-1/2 -translate-y-1/2 rounded p-0.5 hover:bg-accent/10 transition-colors disabled:opacity-50"
|
||||
tabIndex={-1}
|
||||
aria-label="Open calendar"
|
||||
>
|
||||
|
||||
@ -205,7 +205,14 @@ input[type="datetime-local"]::-webkit-calendar-picker-indicator {
|
||||
.datepicker-wrapper input::-webkit-calendar-picker-indicator {
|
||||
display: none;
|
||||
}
|
||||
/* Firefox: opaque background on the custom icon covers the native one (see date-picker.tsx) */
|
||||
/* Firefox: -moz-appearance: textfield strips all native chrome including the calendar icon.
|
||||
This is safe because the DatePicker component provides its own custom popup. */
|
||||
@-moz-document url-prefix() {
|
||||
.datepicker-wrapper input[type="date"],
|
||||
.datepicker-wrapper input[type="datetime-local"] {
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
}
|
||||
|
||||
/* ── Form validation — red outline only after submit attempt ── */
|
||||
form[data-submitted] input:invalid,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user