UNPKG

test-isc

Version:

An Ionic component similar to Ionic Select, that allows to search items, including async search, group, add, edit, delete items, and much more.

1 lines 646 B
const o=["Tab","ArrowDown","Space","Escape"," ","Shift","Enter","ArrowLeft","ArrowRight","ArrowUp"],t=()=>{let t=[],c=!0;const e=document,n=o=>{t.forEach(o=>o.classList.remove("ion-focused")),o.forEach(o=>o.classList.add("ion-focused")),t=o},r=()=>{c=!1,n([])};e.addEventListener("keydown",t=>{c=o.includes(t.key),c||n([])}),e.addEventListener("focusin",o=>{if(c&&o.composedPath){const t=o.composedPath().filter(o=>!!o.classList&&o.classList.contains("ion-focusable"));n(t)}}),e.addEventListener("focusout",()=>{e.activeElement===e.body&&n([])}),e.addEventListener("touchstart",r),e.addEventListener("mousedown",r)};export{t as startFocusVisible}