Skip to content

#6294: 🐛 Fix inline range datepicker resetting selection on handleSelect#81

Open
balajis-qb wants to merge 1 commit into
mainfrom
issue-6294/fix/range-datepicker-inline-reset
Open

#6294: 🐛 Fix inline range datepicker resetting selection on handleSelect#81
balajis-qb wants to merge 1 commit into
mainfrom
issue-6294/fix/range-datepicker-inline-reset

Conversation

@balajis-qb

Copy link
Copy Markdown
Collaborator

Description

Linked issue: Hacker0x01#6294

Problem
The handleSelect handler unconditionally calls setOpen(false). While this behavior is correct for non-inline datepickers (which should close after selection), it causes unintended side effects in inline mode.

Inline datepickers do not close, but invoking setOpen(false) still triggers a focus reset. This results in the component switching back to selecting startDate, effectively losing the current range selection and creating a broken user experience.

Changes

  • Added a conditional check to skip calling setOpen(false) when the datepicker is in inline mode
  • Preserved existing behavior for non-inline datepickers
  • Prevented unnecessary focus resets that were causing selection state loss

Behavior Changes

  • Inline mode: Range selection is preserved correctly after selecting dates
  • Non-inline mode: No change; picker continues to close after selection

Contribution checklist

  • I have followed the contributing guidelines.
  • I have added sufficient test coverage for my changes.
  • I have formatted my code with Prettier and checked for linting issues with ESLint for code readability.

… on handleSelect

Avoid calling setOpen(false) inside handleSelect when the datepicker is in inline mode. Inline pickers do not close, but triggering setOpen(false) causes a focus reset that switches selection back to startDate, effectively losing the current range selection.

This change ensures that inline range pickers preserve the active selection state while maintaining existing behavior for non-inline modes.

Fixes Hacker0x01#6294
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant