diff options
Diffstat (limited to 'app/javascript/flavours/glitch/util/dom_helpers.js')
-rw-r--r-- | app/javascript/flavours/glitch/util/dom_helpers.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/util/dom_helpers.js b/app/javascript/flavours/glitch/util/dom_helpers.js new file mode 100644 index 000000000..d94aeb9d4 --- /dev/null +++ b/app/javascript/flavours/glitch/util/dom_helpers.js @@ -0,0 +1,14 @@ +// Package imports. +import { supportsPassiveEvents } from 'detect-passive-events'; + +// This will either be a passive lister options object (if passive +// events are supported), or `false`. +export const withPassive = supportsPassiveEvents ? { passive: true } : false; + +// Focuses the root element. +export function focusRoot () { + let e; + if (document && (e = document.querySelector('.ui')) && (e = e.parentElement)) { + e.focus(); + } +} |