fix: support custom focus targets in DateRangePicker - #10604
Open
ZedingZhang wants to merge 1 commit into
Open
ZedingZhang wants to merge 1 commit into
ZedingZhang wants to merge 1 commit into
Conversation
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 #5766
DateRangePickerfocus handlers currently default their event target toElement, which makes them incompatible with form libraries whose handlers useFocusEvent<HTMLElement>. This change allows consumers to provide a focus event target type while retainingElementas the default for backward compatibility.The target generic is propagated only through the types required by
DateRangePicker: the shared stately date picker base, range picker state options,useDateRangePicker, and the React Aria ComponentsDateRangePicker.DateField,DatePicker, and the Spectrum component APIs remain unchanged. A type regression test covers spreading form-styleonFocusandonBlurhandlers that targetHTMLElementintoDateRangePicker.This change was developed with assistance from Codex. I reviewed and understand every change and
remain responsible for this contribution.
✅ Pull Request Checklist:
📝 Test Instructions:
yarn check-types.DateRangePickerProps<DateValue, HTMLElement>object withonFocusandonBlurhandlers typed as
React.FocusEvent<HTMLElement>can be spread into<DateRangePicker />.Automated checks run locally:
corepack yarn check-typescorepack yarn oxfmt --checkon the five changed filescorepack yarn oxlinton the five changed filescorepack yarn test packages/react-aria-components/test/DateRangePicker.test.js packages/react-aria/test/datepicker/useDatePicker.test.tsx --runInBand(17 tests passed)🧢 Your Project:
Personal/open-source contribution.