Skip to content

Commit bcc4bcf

Browse files
committed
make selector ignore groups
1 parent 0c4c3f8 commit bcc4bcf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/react/src/drafts/SelectPanel2/SelectPanel.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ const Panel: React.FC<SelectPanelProps> = ({
165165

166166
// used in SelectPanel.SearchInput
167167
const moveFocusToList = () => {
168-
const firstListElement = dialogRef.current?.querySelector('ul[role=listbox] li') as HTMLLIElement | undefined
168+
const selector = 'ul[role=listbox] li:not([role=none])'
169+
// being specific about roles because there can be another ul (tabs in header) and an ActionList.Group (li[role=none])
170+
const firstListElement = dialogRef.current?.querySelector(selector) as HTMLLIElement | undefined
169171
firstListElement?.focus()
170172
}
171173

0 commit comments

Comments
 (0)