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

Function focusLastDescendant

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

Source from the content-addressed store, hash-verified

42 * If no fallback is specified then we focus the container itself.
43 */
44export const focusLastDescendant = <R extends HTMLElement, T extends HTMLElement>(ref: R, fallbackElement?: T) => {
45 const inputs = Array.from(ref.querySelectorAll<HTMLElement>(focusableQueryString));
46 const lastInput = inputs.length > 0 ? inputs[inputs.length - 1] : null;
47
48 focusElementInContext(lastInput, fallbackElement ?? ref);
49};
50
51/**
52 * Focuses a particular element in a context. If the element

Callers 3

trapKeyboardFocusMethod · 0.90
trapScopedFocusFunction · 0.90
trapShadowFocusFunction · 0.90

Calls 2

focusElementInContextFunction · 0.85
fromMethod · 0.80

Tested by

no test coverage detected