Skip to content

Commit 79505ba

Browse files
authored
fix: prevent combobox from closing when navigating through items with keyboard (#8301)
* fix: stop combobox from closing when keyboard navigating * fix lint * remove dependencies * update type
1 parent 444a13d commit 79505ba

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

packages/@react-aria/selection/src/useSelectableCollection.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -525,12 +525,12 @@ export function useSelectableCollection(options: AriaSelectableCollectionOptions
525525
raf.current = requestAnimationFrame(() => {
526526
if (scrollRef.current) {
527527
scrollIntoView(scrollRef.current, element);
528+
// Avoid scroll in iOS VO, since it may cause overlay to close (i.e. RAC submenu)
529+
if (modality !== 'virtual') {
530+
scrollIntoViewport(element, {containingElement: ref.current});
531+
}
528532
}
529533
});
530-
// Avoid scroll in iOS VO, since it may cause overlay to close (i.e. RAC submenu)
531-
if (modality !== 'virtual') {
532-
scrollIntoViewport(element, {containingElement: ref.current});
533-
}
534534
}
535535
}
536536

packages/@react-spectrum/tag/test/TagGroup.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,7 @@ describe('TagGroup', function () {
635635
expect(buttons[1]).toHaveTextContent('Clear');
636636

637637
await user.tab();
638+
act(() => jest.runAllTimers());
638639
expect(document.activeElement).toBe(tags[0]);
639640

640641
await user.tab();

0 commit comments

Comments
 (0)