fix: handle Escape in date/datetime pickers and remove ValidationStep any (#18107)

## Summary
- **DatePicker / DateTimePicker:** Call onEscape when user presses
Escape (fixes FIXME).
- **FormDateFieldInput:** Revert input/picker on Escape; handle Escape
in text input.
- **FormDateTimeFieldInput:** Remove FIXME.
- **ValidationStep:** Replace any with typed callback.

---------

Co-authored-by: Thomas Trompette <thomas.trompette@sfr.fr>
This commit is contained in:
kpdev
2026-03-06 06:19:23 -08:00
committed by GitHub
parent 403db7ad3f
commit cac4999e9f
4 changed files with 2 additions and 6 deletions
@@ -200,8 +200,6 @@ export const FormDateFieldInput = ({
const handlePickerEnter = () => {};
const handlePickerEscape = () => {
// FIXME: Escape key is not handled properly by the underlying DateInput component. We need to solve that.
setDraftValue({
type: 'static',
value: draftValue.value,
@@ -141,8 +141,6 @@ export const FormDateTimeFieldInput = ({
const handlePickerEnter = () => {};
const handlePickerEscape = () => {
// FIXME: Escape key is not handled properly by the underlying DateInput component. We need to solve that.
setDraftValue({
type: 'static',
value: draftValue.value,
@@ -1,5 +1,5 @@
import { styled } from '@linaria/react';
import { Suspense, lazy, useContext, type ComponentType } from 'react';
import { lazy, Suspense, useContext, type ComponentType } from 'react';
import type { ReactDatePickerProps as ReactDatePickerLibProps } from 'react-datepicker';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
@@ -11,7 +11,7 @@ import { getHighlightedDates } from '@/ui/input/components/internal/date/utils/g
import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { Suspense, lazy, useContext, type ComponentType } from 'react';
import { lazy, Suspense, useContext, type ComponentType } from 'react';
import type { ReactDatePickerProps as ReactDatePickerLibProps } from 'react-datepicker';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';