From 3ae1e5b786ec27cdea1622cfb62a4541329f13d5 Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Thu, 9 Mar 2017 18:13:00 -0800 Subject: [PATCH] [fix] don't run 'modality' without a DOM Fix #387 --- src/modules/modality/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/modules/modality/index.js b/src/modules/modality/index.js index e7f9a10d..247daefb 100644 --- a/src/modules/modality/index.js +++ b/src/modules/modality/index.js @@ -1,5 +1,7 @@ /* global document, window */ +import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment'; + /** * Adapts focus styles based on the user's active input modality (i.e., how * they are interacting with the UI right now). @@ -16,6 +18,10 @@ * Based on https://github.com/WICG/modality */ const modality = () => { + if (!canUseDOM) { + return; + } + /** * Determine whether the keyboard is required when an element is focused */