diff --git a/package-lock.json b/package-lock.json index 97cbe95cc..6f8ca51c4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29426,6 +29426,7 @@ "@react-spectrum/theme-default": "^3.5.1", "@react-spectrum/toast": "^3.0.0-beta.16", "@react-spectrum/utils": "^3.11.5", + "@react-types/combobox": "3.13.1", "@react-types/radio": "^3.8.1", "@react-types/shared": "^3.22.1", "@react-types/textfield": "^3.9.1", @@ -31957,6 +31958,7 @@ "@react-spectrum/theme-default": "^3.5.1", "@react-spectrum/toast": "^3.0.0-beta.16", "@react-spectrum/utils": "^3.11.5", + "@react-types/combobox": "3.13.1", "@react-types/radio": "^3.8.1", "@react-types/shared": "^3.22.1", "@react-types/textfield": "^3.9.1", diff --git a/packages/components/src/spectrum/picker/usePickerScrollOnOpen.test.ts b/packages/components/src/spectrum/picker/usePickerScrollOnOpen.test.ts index e09cef195..e21f49e8d 100644 --- a/packages/components/src/spectrum/picker/usePickerScrollOnOpen.test.ts +++ b/packages/components/src/spectrum/picker/usePickerScrollOnOpen.test.ts @@ -49,9 +49,14 @@ describe('usePickerScrollOnOpen', () => { expect(result.current.ref).toBe(mockUsePopoverOnScrollRefResult.ref); }); - it.each([true, false])( - 'should return a callback that calls popoverOnOpenChange and onOpenChange: %s', - isOpen => { + it.each([ + [true, undefined], + [false, undefined], + [true, 'input'], + [false, 'input'], + ] as const)( + 'should return a callback that calls popoverOnOpenChange and onOpenChange: %s, %s', + (isOpen, menuTrigger) => { const { result } = renderHook(() => usePickerScrollOnOpen({ getInitialScrollPosition, @@ -60,12 +65,12 @@ describe('usePickerScrollOnOpen', () => { }) ); - result.current.onOpenChange(isOpen); + result.current.onOpenChange(isOpen, menuTrigger); expect(mockUsePopoverOnScrollRefResult.onOpenChange).toHaveBeenCalledWith( isOpen ); - expect(onOpenChange).toHaveBeenCalledWith(isOpen); + expect(onOpenChange).toHaveBeenCalledWith(isOpen, menuTrigger); } ); }); diff --git a/packages/components/src/spectrum/picker/usePickerScrollOnOpen.ts b/packages/components/src/spectrum/picker/usePickerScrollOnOpen.ts index dd0587efc..884923b33 100644 --- a/packages/components/src/spectrum/picker/usePickerScrollOnOpen.ts +++ b/packages/components/src/spectrum/picker/usePickerScrollOnOpen.ts @@ -14,7 +14,7 @@ export interface UsePickerScrollOnOpenOptions { export interface UsePickerScrollOnOpenResult { ref: DOMRef; - onOpenChange: (isOpen: boolean) => void; + onOpenChange: (isOpen: boolean, menuTrigger?: MenuTriggerAction) => void; } /**