CSS selector to locate the element.
Optional
options: FocusOptions & { fallbackTabIndex?: boolean }Focus options.
Prevent scrolling when focusing. Defaults to false
.
Add tabindex="-1"
if element is not focusable. Defaults to false
.
Optional
fallbackTabIndex?: booleanAdd tabindex="-1"
if element is not focusable. Defaults to false
.
true
if element was found and focused, false
otherwise.
Focuses the first element matching a CSS selector.
Skips disabled elements. Optionally adds a temporary
tabindex
for non-focusable elements.