Repository navigation
Description
Description
After selecting a date through DateInput's calendar and clicking the clear button, the input is empty, but reopening the calendar still shows the previous date as selected. The same select → clear → reopen sequence leaves a stale date in DateTimeInput and a stale range in DateRangeInput. The retained cells still report aria-selected="true"; this is not just the today marker or keyboard focus.
This comes from the empty-value boundary between the inputs and Calendar. A calendar click writes internalValue even when a controlled value is supplied, and Calendar falls back to that internal value when value becomes undefined. After clear, DateInput passes the empty value through, and DateTimeInput does the same for its date portion. DateRangeInput clears to null, but converts it to undefined before passing it to Calendar, producing the same fallback.
Expected: once the parent accepts the clear, the calendar should show no selected date or range. Keeping the visible month, today's marker, or a keyboard-focus target is separate from retaining the cleared selection. This should not require remounting the input or changing its documented clear callback value.
Reproduction
Open the published DateInput — Clearable story on a desktop fine pointer:
- Click Open calendar and select April 15, 2026. The field now displays that date and the popover closes.
- Click Clear Event date. The field becomes empty.
- Click Open calendar again. April 15 is still highlighted, its day button's accessible label still includes
selected, and its containing gridcell hasaria-selected="true".
Selecting through the calendar before clearing matters: clearing only the story's initial prop value may not reproduce the issue, because no calendar click has populated internalValue.
The same behavior is reproducible in DateTimeInput — With Clear Button after selecting March 16 and clearing: both fields become empty, but March 16 remains selected on reopen. In DateRangeInput — Default, pick two dates to complete a range, clear, and reopen: the trigger returns to Select date range, but the previous range's cells remain selected.
A minimal controlled example (without custom theme or styles):
import {useState} from 'react';
import {DateInput, type DateInputProps} from '@astryxdesign/core/DateInput';
export default function Repro() {
const [value, setValue] = useState<DateInputProps['value']>('2026-04-06');
return (
<DateInput
label="Event date"
value={value}
onChange={setValue}
hasClear
nativePicker="never"
/>
);
}Astryx Version
Reproduced in the published Storybook. Source inspected at b6499a1 (@astryxdesign/[email protected] declared there); the Storybook deployment commit/version was not independently identified. npm artifact not separately tested.
Environment
Chrome 154 on macOS, mouse interaction with the desktop Astryx calendar popovers. OS version and assistive technology were not separately verified; native pickers, touch surfaces, and other browser engines were not tested.
Activity
fix(DateInput): keep cleared calendars empty (#6935)