fix: check document instead of window to detect browser (#1833)

pull/1568/merge
Divyansh Singh 2 years ago committed by GitHub
parent 1553dbce8e
commit 0f145cb3c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,4 +1,5 @@
import { type Ref, ref, watch, readonly, onUnmounted } from 'vue'
import { inBrowser } from '../../shared.js'
interface UseFlyoutOptions {
el: Ref<HTMLElement | undefined>
@ -14,7 +15,7 @@ let listeners = 0
export function useFlyout(options: UseFlyoutOptions) {
const focus = ref(false)
if (typeof window !== 'undefined') {
if (inBrowser) {
!active && activateFocusTracking()
listeners++

@ -20,7 +20,7 @@ export const APPEARANCE_KEY = 'vitepress-theme-appearance'
export const HASH_RE = /#.*$/
export const EXT_RE = /(index)?\.(md|html)$/
export const inBrowser = typeof window !== 'undefined'
export const inBrowser = typeof document !== 'undefined'
export const notFoundPageData: PageData = {
relativePath: '',

Loading…
Cancel
Save