fix build

This commit is contained in:
Cloudburst 2022-08-27 10:48:41 +02:00
parent 711823a824
commit 1b2f76b8fa
2 changed files with 6 additions and 2 deletions

View File

@ -2,7 +2,9 @@ import { init } from '@noriginmedia/norigin-spatial-navigation';
require("prism-themes/themes/prism-dracula.min.css")
if (window !== undefined) {
const isBrowser = typeof window !== "undefined"
if (isBrowser) {
init({
visualDebug: false
});

View File

@ -3,6 +3,8 @@ import { useFocusable } from '@noriginmedia/norigin-spatial-navigation';
import { Link, navigate } from "gatsby";
const isBrowser = typeof window !== "undefined"
function CompatBtn({autoFocus, href, onClick, group, target, children, className, ...props}) {
const { ref, focused, focusSelf} = useFocusable();
@ -17,7 +19,7 @@ function CompatBtn({autoFocus, href, onClick, group, target, children, className
ref.current?.focus()
}
if (window) {
if (isBrowser) {
window.addEventListener("keyup", (ev) => {
if (!focused) return;
if (document.activeElement !== ref.current) return;