fix: selectDate not working with uncontrolled calendar and isDateUnavailable - #10328
fix: selectDate not working with uncontrolled calendar and isDateUnavailable#10328cycsmail wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
I made some changes to hit a little more surface area with tests and simplify the code to convey intent.
Looks like you need to sign the CLA https://github.com/adobe/react-spectrum/blob/main/CONTRIBUTING.md#contributor-license-agreement
|
thanks for the cleanup! CLA should be signed now, done it a couple days back. let me know if it's still not showing. |
|
trying to get the CLA to show up |
|
I've never seen it show this icon before. I'm not sure why it's not working. The most common reason it doesn't work is that a different e-mail was used compared to the Github account. Could you humour me and double check that you've used the same one? Otherwise sometimes the service goes down, but it didn't change last week to this week, so I doubt it's that. |
Closes #7779
normalizeValuepassedstartDate(the start of the visible range) as the lower bound topreviousAvailableDate. When you select a date that falls before the visible range, for example programmatically while a later month is shown, that search window is empty so the selection was always rejected andvaluestayed null. It only showed up whenisDateUnavailablewas set, since that's the path that goes throughpreviousAvailableDate. The fix clamps the lower bound to the selected date when the date is beforestartDate, so a date outside the visible range can still be selected. In-range selection is unchanged.✅ Pull Request Checklist:
📝 Test Instructions:
Render an uncontrolled Calendar with
isDateUnavailable, navigate to another month, then callselectDatewith a date outside the visible range, it should now select instead of doing nothing. Addedpackages/react-stately/test/calendar/useCalendarState.test.tscovering selecting a date both before and after the visible range. The before-range test fails without this change and passes with it, and the existing react-aria calendar + Calendar/RangeCalendar suites still pass. Runyarn jest useCalendarState.🧑 Your Project:
N/A