We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9119be0 commit 79f5b27Copy full SHA for 79f5b27
1 file changed
packages/docsearch-react/src/DocSearchButton.tsx
@@ -11,10 +11,6 @@ export type DocSearchButtonProps = React.DetailedHTMLProps<
11
const ACTION_KEY_DEFAULT = 'Ctrl' as const;
12
const ACTION_KEY_APPLE = '⌘' as const;
13
14
-function hasNavigator() {
15
- return typeof navigator === 'undefined';
16
-}
17
-
18
function isAppleDevice() {
19
return /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);
20
}
@@ -28,7 +24,7 @@ export const DocSearchButton = React.forwardRef<
28
24
>(null);
29
25
30
26
useEffect(() => {
31
- if (hasNavigator()) {
27
+ if (typeof navigator !== 'undefined') {
32
setKey(isAppleDevice() ? ACTION_KEY_APPLE : ACTION_KEY_DEFAULT);
33
34
}, []);
0 commit comments