Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions packages/docsearch-react/src/DocSearchButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react';
import React, { useState } from 'react';

import { ControlKeyIcon } from './icons/ControlKeyIcon';
import { SearchIcon } from './icons/SearchIcon';
Expand All @@ -25,15 +25,14 @@ export const DocSearchButton = React.forwardRef<
>(({ translations = {}, ...props }, ref) => {
const { buttonText = 'Search', buttonAriaLabel = 'Search' } = translations;

const [key, setKey] = useState<
const [key] = useState<
Comment thread
chenxsan marked this conversation as resolved.
Outdated
typeof ACTION_KEY_APPLE | typeof ACTION_KEY_DEFAULT | null
>(null);

useEffect(() => {
>(() => {
if (typeof navigator !== 'undefined') {
setKey(isAppleDevice() ? ACTION_KEY_APPLE : ACTION_KEY_DEFAULT);
return isAppleDevice() ? ACTION_KEY_APPLE : ACTION_KEY_DEFAULT;
}
}, []);
return null;
});

return (
<button
Expand Down