Skip to content

RangeCalendar selects hovered date on popover close #8850

@Jiiieeef

Description

@Jiiieeef

Provide a general summary of the issue here

Not sure if this is a bug or a intended behavior but I have an issue when I use a RangeCalendar in a Popover.

I select a start date and an end date, I close the popover. But if I re-open the calendar, select a new start date without selecting an end date, and close the popover by clicking outside of it, the end date is set to the hovered date.

The same behavior happen if nothing is selected yet.

You can see an example with this video:
https://github.com/user-attachments/assets/85074143-e711-4b60-b4f5-88a527af091a

🤔 Expected Behavior?

I expect that the popover is just closed, without selecting the hovered date. Or if this an expected behavior, at least a way to toggle this feature with a property.

😯 Current Behavior

As you can see on the codesanbox below, the onChange callback is called when the popover is closed, which I think is why the dates are set.

💁 Possible Solution

No response

🔦 Context

No response

🖥️ Steps to Reproduce

You can see a fork of the example showed on the documentation here: https://codesandbox.io/p/sandbox/lucid-wildflower-lcxftz

Open the popover, select a start date and click outside of the end date and the dates will be selected.

Note: I upgraded the version of react-aria and react-stately to he current one (3.43.1) because on the codesandbox in the documentation with the version 3.35.1, I didn't have the issue but if I download the content of the sandbox (with the version 3.35.1) I had the issue.

Version

3.43.1

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

Mas OS

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

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