#4601·rsuite

DateRangePicker: value cleared with Backspace is kept (clear button stays, value comes back on focus)

Author: scharlitoCreated Sep 24, 2026Updated Sep 24, 2026

What version of rsuite are you using?

5.83.4

What version of React are you using?

19.2.8

What version of TypeScript are you using (if any)?

6.0.3

What browser are you using?

Chrome

Describe the Bug

Clearing a DateRangePicker value from the keyboard (Tab into the field, Backspace) does not clear the picker. While the field is focused the values are still displayed; once it loses focus it shows the empty placeholder mask, but the clear button ("X") stays, onChange is never called and the value is still there — focusing the field again shows it. Clicking the "X" works correctly.

Image

DatePicker handles the same interaction correctly, so the two pickers are inconsistent.

Cause (5.83.4, still the same on main):

  • DateRangeInput: onSegmentValueRemove → when the whole text is selected, handleClear → onChange(null, event).

  • DateRangePicker.tsx, handleInputChange, the callback passed as onChange to DateRangeInput:

    const handleInputChange = useEventCallback((value: [Date, Date] | null, event) => { if (!value) { return; // <- the null from handleClear is dropped: no setDateRange, no onChange } ...

  • DatePicker.tsx, handleInputChange, forwards the same null: updateValue(event, value, false) → onChange(null).

Because onChange never fires, a controlled value keeps the old range, hasValue stays true, so the clean button stays; after blur the input only looks empty until it is focused again. In a form this means the user believes the field is empty while the old range is submitted.

Expected Behavior

Clearing the typed value should behave like clicking the clear button and like DatePicker: onChange(null) is called, the value is cleared, the clean button disappears, and re-focusing the field shows the empty mask.

Suggested fix in DateRangePicker.handleInputChange: instead of returning on null, treat it as an erase, e.g. setDateRange(event, null, false) (what handleClean already does).

To Reproduce

Reproducible on the docs page https://rsuitejs.com/components/date-range-picker/ , section "Customize the date format", the dd.MM.yyyy example.

  1. Pick a range, e.g. 15.09.2026 ~ 19.09.2026, then clear it with the "X". It would look like that afterwards:
Image
  1. Pick the same range again.
Image
  1. Tab into the field (from the previous input) and press Backspace. → The values are still displayed.
Image
  1. Leave the field (Tab / click elsewhere). → The field shows the empty placeholder mask, but the "X" is still there.
Image
  1. Focus the field again. → The value 15.09.2026 ~ 19.09.2026 is back.
Image

Compare with the DatePicker docs page: the same steps clear the value and hide the "X".