MCPcopy Create free account
hub / github.com/Rello/analytics / onKeydown

Function onKeydown

js/userGuidance.js:34–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32 container.setAttribute('aria-modal', 'true');
33 container.tabIndex = -1;
34 const onKeydown = event => {
35 if (event.defaultPrevented) return;
36 if (event.key === 'Escape') {
37 event.preventDefault();
38 event.stopPropagation();
39 close();
40 } else if (event.key === 'Tab') {
41 const controls = OCA.Analytics.Dialog.focusable(container);
42 const index = controls.indexOf(document.activeElement);
43 if (!controls.length || index < 0 || (!event.shiftKey && index === controls.length - 1)
44 || (event.shiftKey && index === 0)) {
45 event.preventDefault();
46 (event.shiftKey ? controls.at(-1) : controls[0])?.focus();
47 }
48 }
49 };
50 container.addEventListener('keydown', onKeydown);
51 container._analyticsDialogDeactivate = () => {
52 container.removeEventListener('keydown', onKeydown);

Callers

nothing calls this directly

Calls 1

focusMethod · 0.80

Tested by

no test coverage detected