MCPcopy Create free account
hub / github.com/Thanas-R/Virdis / handleClickOutside

Function handleClickOutside

src/components/SearchBar.tsx:26–30  ·  view source on GitHub ↗
(e: MouseEvent)

Source from the content-addressed store, hash-verified

24 const containerRef = useRef<HTMLDivElement>(null);
25
26 useEffect(() => {
27 const handleClickOutside = (e: MouseEvent) => {
28 if (containerRef.current && !containerRef.current.contains(e.target as Node)) {
29 setShowResults(false);
30 }
31 };
32 document.addEventListener("mousedown", handleClickOutside);
33 return () => document.removeEventListener("mousedown", handleClickOutside);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected