You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using defaultOpen={true} on the ReactAriaDatePicker component, the calendar should open by default, but child Button elements should maintain their normal state unless explicitly pressed. The isPressed state should only apply to the trigger button that opens the calendar, not all Button components within the DatePicker hierarchy.
🤔 Expected Behavior?
When using defaultOpen={true} on the ReactAriaDatePicker component, the calendar should open by default, but child Button elements should maintain their normal state unless explicitly pressed. The isPressed state should only apply to the trigger button that opens the calendar, not all Button components within the DatePicker hierarchy.
😯 Current Behavior
Setting defaultOpen={true} on ReactAriaDatePicker causes all child Button elements within the component hierarchy to receive an isPressed=true state by default, even when they're not directly related to the opening/closing mechanism of the calendar.
I've been looking into this issue regarding the isPressed state propagation when defaultOpen={true} is used on the DatePicker.
I had an idea for a potential solution/fix. My approach would be to refactor the DatePicker implementation to avoid using the Button Context to propagate the isPressed={state.isOpen} state to all child buttons. Instead, the trigger button component(like DatePickerTrigger) could be updated to directly access the DatePicker's state (e.g., using useDatePickerState or context) and apply the pressed state based on state.isOpen specifically to itself. This would prevent unintended isPressed states on other buttons within the DatePicker.
What do you think of this approach? If this direction seems acceptable, I would be willing to work on a pull request to implement it.
Provide a general summary of the issue here
When using defaultOpen={true} on the ReactAriaDatePicker component, the calendar should open by default, but child Button elements should maintain their normal state unless explicitly pressed. The isPressed state should only apply to the trigger button that opens the calendar, not all Button components within the DatePicker hierarchy.
🤔 Expected Behavior?
When using defaultOpen={true} on the ReactAriaDatePicker component, the calendar should open by default, but child Button elements should maintain their normal state unless explicitly pressed. The isPressed state should only apply to the trigger button that opens the calendar, not all Button components within the DatePicker hierarchy.
😯 Current Behavior
Setting defaultOpen={true} on ReactAriaDatePicker causes all child Button elements within the component hierarchy to receive an isPressed=true state by default, even when they're not directly related to the opening/closing mechanism of the calendar.
💁 Possible Solution
No response
🔦 Context
No response
🖥️ Steps to Reproduce
You can check the issue in below code sandbox link
https://codesandbox.io/p/sandbox/qyzpxw
Version
react-aria-components:1.8.0
What browsers are you seeing the problem on?
Chrome
If other, please specify.
No response
What operating system are you using?
Ubuntu 24.04.2 LTS
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response
The text was updated successfully, but these errors were encountered: