@elemental/ui / Function

getFocusableElements

Return a list of focusable elements inside an HTMLElement

Presentation

function getFocusableElements(element: HTMLElement): NodeListOf<HTMLElement>;

Returns

NodeListOf<HTMLElement>

Parameters

NameTypeDescription
element
HTMLElement

@param element The element to search for focusable elements

Overloads

Overload #1

Return a list of focusable elements inside an HTMLElement

Presentation
getFocusableElements(element: HTMLElement): NodeListOf<HTMLElement>;
Parameters
NameTypeDescription
element
HTMLElement

@param element The element to search for focusable elements

Returns
NodeListOf<HTMLElement>
Overload #2

Return a list of focusable elements inside an HTMLElement within a specific scope it adds element itself if it can get focus

Presentation
getFocusableElements(element: HTMLElement, scope: string): NodeListOf<HTMLElement>;
Parameters
NameTypeDescription
element
HTMLElement

@param element The element to search for focusable elements

scope
string

@param scope The scope to search for focusable elements, it should be a valid CSS scope. See the selector {@link https://developer.mozilla.org/en-US/docs/web/api/element/queryselectorall#selector_scope scope} example.

Returns
NodeListOf<HTMLElement>