From bcc4bcf70da4ad6fc9adf149499387af082ff893 Mon Sep 17 00:00:00 2001 From: Siddharth Kshetrapal Date: Mon, 12 Feb 2024 17:16:01 +0100 Subject: [PATCH] make selector ignore groups --- packages/react/src/drafts/SelectPanel2/SelectPanel.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/react/src/drafts/SelectPanel2/SelectPanel.tsx b/packages/react/src/drafts/SelectPanel2/SelectPanel.tsx index e6116fdcaa8..73d0e40be77 100644 --- a/packages/react/src/drafts/SelectPanel2/SelectPanel.tsx +++ b/packages/react/src/drafts/SelectPanel2/SelectPanel.tsx @@ -165,7 +165,9 @@ const Panel: React.FC = ({ // used in SelectPanel.SearchInput const moveFocusToList = () => { - const firstListElement = dialogRef.current?.querySelector('ul[role=listbox] li') as HTMLLIElement | undefined + const selector = 'ul[role=listbox] li:not([role=none])' + // being specific about roles because there can be another ul (tabs in header) and an ActionList.Group (li[role=none]) + const firstListElement = dialogRef.current?.querySelector(selector) as HTMLLIElement | undefined firstListElement?.focus() }