Skip to content

Commit

Permalink
Fix selection of tracked objects in Explore on desktop Safari (#16153)
Browse files Browse the repository at this point in the history
* ensure meta click works on desktop safari to select objects in explore

* don't break mobile
  • Loading branch information
hawkeye217 authored Jan 26, 2025
1 parent 6d8234f commit 9efc20e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion web/src/components/card/SearchThumbnail.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useMemo } from "react";
import { useCallback, useMemo } from "react";
import { useApiHost } from "@/api";
import { getIconForLabel } from "@/utils/iconUtil";
import useSWR from "swr";
Expand Down Expand Up @@ -33,6 +33,16 @@ export default function SearchThumbnail({
onClick(searchResult, true, false);
});

const handleOnClick = useCallback(
(e: React.MouseEvent<HTMLDivElement>) => {
if (e.metaKey) {
e.stopPropagation();
onClick(searchResult, true, false);
}
},
[searchResult, onClick],
);

const objectLabel = useMemo(() => {
if (
!config ||
Expand All @@ -57,6 +67,7 @@ export default function SearchThumbnail({
<div className={`size-full ${imgLoaded ? "visible" : "invisible"}`}>
<img
ref={imgRef}
onClick={handleOnClick}
className={cn(
"size-full select-none object-cover object-center opacity-100 transition-opacity",
)}
Expand Down

0 comments on commit 9efc20e

Please sign in to comment.