From 8a027e5fb3e3febd6098d7214b591b76ef3f54a9 Mon Sep 17 00:00:00 2001 From: Pio Rasch-Halvorsen Date: Fri, 20 Dec 2019 15:07:10 +0100 Subject: [PATCH] fix(core): use better check for document in tablistener --- packages/core/src/utils/tabListener.ts | 2 +- packages/progress-bar-react/documentation/Example.tsx | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/core/src/utils/tabListener.ts b/packages/core/src/utils/tabListener.ts index 86cba240e10..2a62763a03d 100644 --- a/packages/core/src/utils/tabListener.ts +++ b/packages/core/src/utils/tabListener.ts @@ -23,7 +23,7 @@ function handleKeydown(event: KeyboardEvent) { } export function initTabListener() { - if (document) { + if (typeof document !== "undefined") { document.addEventListener("mousedown", handleMouseDown); } } diff --git a/packages/progress-bar-react/documentation/Example.tsx b/packages/progress-bar-react/documentation/Example.tsx index c8b3750e451..8b3a472d7d1 100644 --- a/packages/progress-bar-react/documentation/Example.tsx +++ b/packages/progress-bar-react/documentation/Example.tsx @@ -1,11 +1,9 @@ import React, { useState } from "react"; import { ProgressBar } from "../src"; -import { initTabListener } from "@fremtind/jkl-core"; import "@fremtind/jkl-progress-bar/progress-bar.css"; import "@fremtind/jkl-core/core.min.css"; export const Example = () => { - initTabListener(); const [val, setVal] = useState(50); return (