1 line
8 KiB
Plaintext
1 line
8 KiB
Plaintext
|
{"version":3,"sources":["webpack:///./node_modules/arrow-key-navigation/dist-web/index.js"],"names":["focusablesQuery","textInputTypes","checkboxRadioInputTypes","focusTrapTest","undefined","getFocusableElements","activeElement","res","elements","element","parent","parentElement","getFocusTrapParent","document","querySelectorAll","len","length","i","disabled","test","getAttribute","hasAttribute","offsetWidth","offsetHeight","push","focusNextOrPrevious","event","key","selectionStart","selectionEnd","tagName","isTextarea","isTextInput","indexOf","toLowerCase","isContentEditable","selection","getSelection","anchorOffset","focusOffset","textContent","value","shouldIgnoreEvent","focusableElements","index","focus","preventDefault","keyListener","altKey","metaKey","ctrlKey","click","handleEnter","register","addEventListener","unregister","removeEventListener","setFocusTrapTest"],"mappings":"0FAAA,4IAQA,IAAIA,EAAkB,wJAKlBC,EAAiB,CAAC,OAAQ,SAAU,MAAO,WAAY,OACvDC,EAA0B,CAAC,WAAY,SACvCC,OAAgBC,EAEpB,SAASC,EAAqBC,GAQ5B,IANA,IAEIC,EAAM,GACNC,GAeN,SAA4BC,GAC1B,IAAKN,EACH,OAGF,IAAIO,EAASD,EAAQE,cAErB,KAAOD,GAAQ,CACb,GAAIP,EAAcO,GAChB,OAAOA,EAGTA,EAASA,EAAOC,eA9BCC,CAAmBN,IACXO,UAEPC,iBAAiBd,GACjCe,EAAMP,EAASQ,OAEVC,EAAI,EAAGA,EAAIF,EAAKE,IAAK,CAC5B,IAAIR,EAAUD,EAASS,GAEnBR,IAAYH,IAAkBG,EAAQS,UAAa,KAAKC,KAAKV,EAAQW,aAAa,aAAe,KAAQX,EAAQY,aAAa,YAClIZ,EAAQa,YAAc,GAAKb,EAAQc,aAAe,KAChDhB,EAAIiB,KAAKf,GAIb,OAAOF,EAuDT,SAASkB,EAAoBC,EAAOC,GAClC,IAAIrB,EAAgBO,SAASP,cAE7B,IAvCF,SAA2BA,EAAeqB,GACxC,IASIC,EACAC,EACAd,EAXAe,EAAUxB,EAAcwB,QACxBC,EAAyB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ourcesContent":["/**\n * Makes it so the left and right arrows change focus, ala Tab/Shift+Tab. This is mostly designed\n * for KaiOS devices.\n */\n\n/* global document, addEventListener, removeEventListener, getSelection */\n// This query is adapted from a11y-dialog\n// https://github.com/edenspiekermann/a11y-dialog/blob/cf4ed81/a11y-dialog.js#L6-L18\nvar focusablesQuery = 'a[href], area[href], input, select, textarea, ' + 'button, iframe, object, embed, [contenteditable], [tabindex], ' + 'video[controls], audio[controls], summary'; // TODO: email/number types are a special type, in that they return selectionStart/selectionEnd as null\n// As far as I can tell, there is no way to actually get the caret position from these inputs. So we\n// don't do the proper caret handling for those inputs, unfortunately.\n// https://html.spec.whatwg.org/multipage/input.html#do-not-apply\n\nvar textInputTypes = ['text', 'search', 'url', 'password', 'tel'];\nvar checkboxRadioInputTypes = ['checkbox', 'radio'];\nvar focusTrapTest = undefined;\n\nfunction getFocusableElements(activeElement) {\n // Respect focus trap inside of dialogs\n var dialogParent = getFocusTrapParent(activeElement);\n var root = dialogParent || document;\n var res = [];\n var elements = root.querySelectorAll(focusablesQuery);\n var len = elements.length;\n\n for (var i = 0; i < len; i++) {\n var element = elements[i];\n\n if (element === activeElement || !element.disabled && !/^-/.test(element
|