Skip to content
Open
Changes from all 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
7 changes: 6 additions & 1 deletion imports/cyto-react-links-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,18 @@ export const CytoReactLinksCard = React.memo<any>(({

useEffect(() => {
inputRef.current.focus();
})
}, []);

const selectLink = useCallback((linkId) => {
setSelectedLink((prevLinkId) => prevLinkId == linkId ? 0 : linkId);
}, []);

useHotkeys('up,right,down,left', e => {
const searchInput = document.activeElement;
if (searchInput instanceof HTMLInputElement || searchInput instanceof HTMLTextAreaElement) {
return;
}
Comment on lines +228 to +231
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

searchInput should be renamed to activeElement, because it can be not only searchInput

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We not should use activeElement from document.


e.preventDefault();
e.stopPropagation();
let index = elements.findIndex(e => e.id == selectedLink);
Expand Down