about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/utils/dom_helpers.js
blob: d94aeb9d47bd7831cc3445e8c60f5497a2c66929 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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();
  }
}