about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/util/dom_helpers.js
blob: 3e1f4a26d7824c39dfedc6ed5334b12c0290cdf7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//  Package imports.
import detectPassiveEvents from 'detect-passive-events';

//  This will either be a passive lister options object (if passive
//  events are supported), or `false`.
export const withPassive = detectPassiveEvents.hasSupport ? { passive: true } : false;

//  Focuses the root element.
export function focusRoot () {
  let e;
  if (document && (e = document.querySelector('.ui')) && (e = e.parentElement)) {
    e.focus();
  }
}