MCPcopy Index your code
hub / github.com/ionic-team/ionic-framework / focusFirstDescendant

Function focusFirstDescendant

core/src/utils/focus-trap.ts:28–32  ·  view source on GitHub ↗
(ref: R, fallbackElement?: T)

Source from the content-addressed store, hash-verified

26 * If no fallback is specified then we focus the container itself.
27 */
28export const focusFirstDescendant = <R extends HTMLElement, T extends HTMLElement>(ref: R, fallbackElement?: T) => {
29 const firstInput = ref.querySelector<HTMLElement>(focusableQueryString);
30
31 focusElementInContext(firstInput, fallbackElement ?? ref);
32};
33
34/**
35 * Focuses the last descendant in a context

Callers 4

trapKeyboardFocusMethod · 0.90
presentMethod · 0.90
trapScopedFocusFunction · 0.90
trapShadowFocusFunction · 0.90

Calls 1

focusElementInContextFunction · 0.85

Tested by

no test coverage detected