From c7c3f07acfebe940de5ac0dc9eb23f09e58d5dd8 Mon Sep 17 00:00:00 2001 From: Anton Tranelis Date: Tue, 30 Jan 2024 21:25:37 +0100 Subject: [PATCH] fix some firefox mobile issue --- .../Subcomponents/Controls/SearchControl.tsx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Components/Map/Subcomponents/Controls/SearchControl.tsx b/src/Components/Map/Subcomponents/Controls/SearchControl.tsx index ea173ecf..b454b59f 100644 --- a/src/Components/Map/Subcomponents/Controls/SearchControl.tsx +++ b/src/Components/Map/Subcomponents/Controls/SearchControl.tsx @@ -18,6 +18,8 @@ import MarkerIconFactory from '../../../../Utils/MarkerIconFactory'; export const SearchControl = ({ clusterRef }) => { + const windowDimensions = useWindowDimensions(); + const [popupOpen, setPopupOpen] = useState(false); const [value, setValue] = useState(''); const [geoResults, setGeoResults] = useState>([]); @@ -33,6 +35,14 @@ export const SearchControl = ({ clusterRef }) => { const resetFilterTags = useResetFilterTags(); const filterTags = useFilterTags(); + useMapEvents({ + popupopen: () => { + setPopupOpen(true); + }, + popupclose: () => { + setPopupOpen(false); + } + }) useDebounce(() => { const searchGeo = async () => { @@ -64,12 +74,16 @@ export const SearchControl = ({ clusterRef }) => { const searchInput = useRef(null); return (<> + {!(windowDimensions.height < 500 && popupOpen && hideSuggestions) &&
setValue(e.target.value)} - onFocus={() => setHideSuggestions(false)} + onFocus={() => { + setHideSuggestions(false); + if(windowDimensions.width < 500) map.closePopup(); + }} onBlur={() => hide()} />
@@ -152,7 +166,7 @@ export const SearchControl = ({ clusterRef }) => { }
} - + } )