@inkline/inkline
Version:
Inkline is the Vue.js UI/UX Library built for creating your next design system
17 lines • 586 B
JavaScript
import { focusAttempt } from './focusAttempt.mjs';
/**
* Find the last descendant node that is focusable.
*
* @param element DOM node for which to find the last focusable descendant.
* @returns true if a focusable element is found and focus is set.
*/
export function focusLastDescendant(element) {
for (let i = element.childNodes.length - 1; i >= 0; i--) {
const child = element.childNodes[i];
if (focusAttempt(child) || focusLastDescendant(child)) {
return true;
}
}
return false;
}
//# sourceMappingURL=focusLastDescendant.mjs.map