Skip to content

Commit 9efc20e

Browse files
authored
Fix selection of tracked objects in Explore on desktop Safari (blakeblackshear#16153)
* ensure meta click works on desktop safari to select objects in explore * don't break mobile
1 parent 6d8234f commit 9efc20e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

web/src/components/card/SearchThumbnail.tsx

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useMemo } from "react";
1+
import { useCallback, useMemo } from "react";
22
import { useApiHost } from "@/api";
33
import { getIconForLabel } from "@/utils/iconUtil";
44
import useSWR from "swr";
@@ -33,6 +33,16 @@ export default function SearchThumbnail({
3333
onClick(searchResult, true, false);
3434
});
3535

36+
const handleOnClick = useCallback(
37+
(e: React.MouseEvent<HTMLDivElement>) => {
38+
if (e.metaKey) {
39+
e.stopPropagation();
40+
onClick(searchResult, true, false);
41+
}
42+
},
43+
[searchResult, onClick],
44+
);
45+
3646
const objectLabel = useMemo(() => {
3747
if (
3848
!config ||
@@ -57,6 +67,7 @@ export default function SearchThumbnail({
5767
<div className={`size-full ${imgLoaded ? "visible" : "invisible"}`}>
5868
<img
5969
ref={imgRef}
70+
onClick={handleOnClick}
6071
className={cn(
6172
"size-full select-none object-cover object-center opacity-100 transition-opacity",
6273
)}

0 commit comments

Comments
 (0)