1 line
1.7 KiB
Plaintext
1 line
1.7 KiB
Plaintext
{"version":3,"sources":["./node_modules/@ionic/core/dist/esm/focus-visible-f4ad4f1a.js"],"names":[],"mappings":";;;;;;;;;;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAE6B","file":"focus-visible-f4ad4f1a-js-es2015.js","sourcesContent":["const ION_FOCUSED = 'ion-focused';\nconst ION_FOCUSABLE = 'ion-focusable';\nconst FOCUS_KEYS = ['Tab', 'ArrowDown', 'Space', 'Escape', ' ', 'Shift', 'Enter', 'ArrowLeft', 'ArrowRight', 'ArrowUp'];\nconst startFocusVisible = () => {\n let currentFocus = [];\n let keyboardMode = true;\n const doc = document;\n const setFocus = (elements) => {\n currentFocus.forEach(el => el.classList.remove(ION_FOCUSED));\n elements.forEach(el => el.classList.add(ION_FOCUSED));\n currentFocus = elements;\n };\n const pointerDown = () => {\n keyboardMode = false;\n setFocus([]);\n };\n doc.addEventListener('keydown', ev => {\n keyboardMode = FOCUS_KEYS.includes(ev.key);\n if (!keyboardMode) {\n setFocus([]);\n }\n });\n doc.addEventListener('focusin', ev => {\n if (keyboardMode && ev.composedPath) {\n const toFocus = ev.composedPath().filter((el) => {\n if (el.classList) {\n return el.classList.contains(ION_FOCUSABLE);\n }\n return false;\n });\n setFocus(toFocus);\n }\n });\n doc.addEventListener('focusout', () => {\n if (doc.activeElement === doc.body) {\n setFocus([]);\n }\n });\n doc.addEventListener('touchstart', pointerDown);\n doc.addEventListener('mousedown', pointerDown);\n};\n\nexport { startFocusVisible };\n"],"sourceRoot":"webpack:///"} |