Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ export function useSelectableCollection(options: AriaSelectableCollectionOptions
}

// If the focused key becomes null (e.g. the last item is deleted), focus the whole collection.
if (manager.isFocused && manager.focusedKey == null && lastFocusedKey.current != null) {
if (!shouldUseVirtualFocus && manager.isFocused && manager.focusedKey == null && lastFocusedKey.current != null) {
focusSafely(ref.current);
}
Comment on lines +427 to 429

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that I've omitted a reset of the manager tracked focus key when the previously focused key of a virtual focus collection is removed from the collection. For the combobox, this would actually cause an option to be focused after the input is changed which historically has caused issues with the NVDA announcement. We can revisit that behavior but for this patch fix I've opted to go with the smallest change possible (should be fine for combobox that the tracked focusedkey isn't in the collection since we clear it in useComboBoxState when the input value changes)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense. I debated it for a little bit in my head and only included it because I was unsure


Expand Down