MCPcopy
hub / github.com/primer/react / moveFocusToList

Function moveFocusToList

packages/react/src/drafts/SelectPanel2/SelectPanel.tsx:157–162  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

155
156 // used in SelectPanel.SearchInput
157 const moveFocusToList = () => {
158 const selector = 'ul[role=listbox] li:not([role=none])'
159 // being specific about roles because there can be another ul (tabs in header) and an ActionList.Group (li[role=none])
160 const firstListElement = dialogRef.current?.querySelector(selector) as HTMLLIElement | undefined
161 firstListElement?.focus()
162 }
163
164 /* Dialog */
165 const dialogRef = React.useRef<HTMLDialogElement>(null)

Callers 2

PanelFunction · 0.85
internalKeyDownFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected