diff --git a/packages/@react-aria/selection/src/useSelectableCollection.ts b/packages/@react-aria/selection/src/useSelectableCollection.ts index a85fdecb54d..317d6e48873 100644 --- a/packages/@react-aria/selection/src/useSelectableCollection.ts +++ b/packages/@react-aria/selection/src/useSelectableCollection.ts @@ -525,12 +525,12 @@ export function useSelectableCollection(options: AriaSelectableCollectionOptions raf.current = requestAnimationFrame(() => { if (scrollRef.current) { scrollIntoView(scrollRef.current, element); + // Avoid scroll in iOS VO, since it may cause overlay to close (i.e. RAC submenu) + if (modality !== 'virtual') { + scrollIntoViewport(element, {containingElement: ref.current}); + } } }); - // Avoid scroll in iOS VO, since it may cause overlay to close (i.e. RAC submenu) - if (modality !== 'virtual') { - scrollIntoViewport(element, {containingElement: ref.current}); - } } } diff --git a/packages/@react-spectrum/tag/test/TagGroup.test.js b/packages/@react-spectrum/tag/test/TagGroup.test.js index f8bb0198bf9..567cd711cd8 100644 --- a/packages/@react-spectrum/tag/test/TagGroup.test.js +++ b/packages/@react-spectrum/tag/test/TagGroup.test.js @@ -635,6 +635,7 @@ describe('TagGroup', function () { expect(buttons[1]).toHaveTextContent('Clear'); await user.tab(); + act(() => jest.runAllTimers()); expect(document.activeElement).toBe(tags[0]); await user.tab();