From dacec9eaf8ac679dcb10281fde89c28a5419eabc Mon Sep 17 00:00:00 2001 From: alec_dev Date: Tue, 28 Jan 2025 11:32:40 -0600 Subject: [PATCH] navigator may not be defined in some environments, like non-browser environments --- .../js_src/lib/components/Preferences/UserDefinitions.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/specifyweb/frontend/js_src/lib/components/Preferences/UserDefinitions.tsx b/specifyweb/frontend/js_src/lib/components/Preferences/UserDefinitions.tsx index 5184e499575..0554d5015a7 100644 --- a/specifyweb/frontend/js_src/lib/components/Preferences/UserDefinitions.tsx +++ b/specifyweb/frontend/js_src/lib/components/Preferences/UserDefinitions.tsx @@ -64,7 +64,8 @@ const isDarkMode = ({ isRedirecting, }: PreferencesVisibilityContext): boolean => isDarkMode || isRedirecting; -const altKeyName = globalThis.navigator?.userAgent?.includes('Mac') +// navigator may not be defined in some environments, like non-browser environments +const altKeyName = typeof navigator !== 'undefined' && navigator?.userAgent?.includes('Mac') ? 'Option' : 'Alt';