UNPKG

@frontify/fondue

Version:
38 lines (37 loc) 868 B
const c = [ "input", "select", "textarea", "button", "a[href]", "area[href]", "summary", "iframe", "object", "embed", "audio[controls]", "video[controls]", '[contenteditable="true"]', "[tabindex]" ].join(':not([hidden]):not([tabindex="-1"]):not([disabled]),'), u = (n, t) => { if (!document.activeElement) return; n.preventDefault(); const e = Array.from(document.querySelectorAll(c)).filter( (l) => s(l) ), o = e.indexOf(document.activeElement), i = (t ? o + 1 : o - 1 + e.length) % e.length, r = e[i]; r && r.focus(); }, s = (n) => { let t = n; for (; t; ) { const e = window.getComputedStyle(t); if (e.display === "none" || e.visibility === "hidden") return !1; t = t.parentElement; } return !0; }; export { u as forceToFocusNextElement }; //# sourceMappingURL=forceToFocusElement.es.js.map