fix: selectDate not working with uncontrolled calendar and isDateUnavailable#10328
Open
cycsmail wants to merge 2 commits into
Open
fix: selectDate not working with uncontrolled calendar and isDateUnavailable#10328cycsmail wants to merge 2 commits into
cycsmail wants to merge 2 commits into
Conversation
snowystinger
approved these changes
Jul 17, 2026
Member
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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