Skip to content

[Bug] Date inputs retain Calendar selection after clearing #6934

Closed

Description

@korkt-kim

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:

  1. Click Open calendar and select April 15, 2026. The field now displays that date and the popover closes.
  2. Click Clear Event date. The field becomes empty.
  3. Click Open calendar again. April 15 is still highlighted, its day button's accessible label still includes selected, and its containing gridcell has aria-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

  1. added a commit that references this issue on Oct 14, 2026
    0f74b22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions