Skip to content

Commit 79f5b27

Browse files
fix: display keyboard shortcuts when platform exists
1 parent 9119be0 commit 79f5b27

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

packages/docsearch-react/src/DocSearchButton.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ export type DocSearchButtonProps = React.DetailedHTMLProps<
1111
const ACTION_KEY_DEFAULT = 'Ctrl' as const;
1212
const ACTION_KEY_APPLE = '⌘' as const;
1313

14-
function hasNavigator() {
15-
return typeof navigator === 'undefined';
16-
}
17-
1814
function isAppleDevice() {
1915
return /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);
2016
}
@@ -28,7 +24,7 @@ export const DocSearchButton = React.forwardRef<
2824
>(null);
2925

3026
useEffect(() => {
31-
if (hasNavigator()) {
27+
if (typeof navigator !== 'undefined') {
3228
setKey(isAppleDevice() ? ACTION_KEY_APPLE : ACTION_KEY_DEFAULT);
3329
}
3430
}, []);

0 commit comments

Comments
 (0)