File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111 */
1212
1313<script lang="ts">
14+ // Globals
15+ import { IN_BROWSER } from ' #v0/constants/globals'
16+
1417 // Components
1518 import { Atom } from ' #v0/components/Atom'
1619 import SelectHiddenInput from ' ./SelectHiddenInput.vue'
158161 const virtualFocus = useVirtualFocus (
159162 () => selection .values ().map (ticket => ({
160163 id: ticket .id ,
161- el : () => document .querySelector <HTMLElement >(` #${CSS .escape (` ${id }-option-${ticket .id } ` )} ` ),
164+ el : () => IN_BROWSER ? document .querySelector <HTMLElement >(` #${CSS .escape (` ${id }-option-${ticket .id } ` )} ` ) : null ,
162165 disabled: ticket .disabled ,
163166 })),
164167 {
Original file line number Diff line number Diff line change 2727 * ```
2828 */
2929
30+ // Globals
31+ import { IN_BROWSER } from '#v0/constants/globals'
32+
3033// Composables
3134import { useContext } from '#v0/composables/createContext'
3235import { createSelection } from '#v0/composables/createSelection'
@@ -194,7 +197,7 @@ export function createCombobox (options: ComboboxOptions = {}): ComboboxContext
194197 . filter ( ticket => filtered . value . has ( ticket . id ) && ! toValue ( ticket . disabled ) )
195198 . map ( ticket => ( {
196199 id : ticket . id ,
197- el : ( ) => document . querySelector < HTMLElement > ( `#${ CSS . escape ( `${ id } -option-${ ticket . id } ` ) } ` ) ,
200+ el : ( ) => IN_BROWSER ? document . querySelector < HTMLElement > ( `#${ CSS . escape ( `${ id } -option-${ ticket . id } ` ) } ` ) : null ,
198201 disabled : ticket . disabled ,
199202 } ) ) ,
200203 {
Original file line number Diff line number Diff line change 3131 * ```
3232 */
3333
34+ // Globals
35+ import { IN_BROWSER } from '#v0/constants/globals'
36+
3437// Composables
3538import {
3639 useDocumentEventListener ,
@@ -349,6 +352,7 @@ export function useClickOutside (
349352 * Handle window blur - detect focus moving to iframe.
350353 */
351354 function onBlur ( event : FocusEvent ) {
355+ if ( ! IN_BROWSER ) return
352356 if ( isPaused . value ) return
353357 if ( event . defaultPrevented ) return
354358
Original file line number Diff line number Diff line change @@ -162,6 +162,7 @@ export function useHotkey (
162162 let groupIndex = 0
163163
164164 function isInputFocused ( ) : boolean {
165+ if ( ! IN_BROWSER ) return false
165166 if ( toValue ( inputs ) ) return false
166167
167168 const activeElement = document . activeElement as HTMLElement | null
You can’t perform that action at this time.
0 commit comments