fix some firefox mobile issue

This commit is contained in:
Anton Tranelis 2024-01-30 20:19:57 +01:00
parent fdc4fb996b
commit d30812fe1b

View File

@ -63,10 +63,14 @@ export const SearchControl = ({ clusterRef }) => {
}))
setTagsResults(tags.filter(tag => tag.id?.toLowerCase().includes(value.toLowerCase())))
}, 500, [value]);
const hide = async () => {
setTimeout(() => {
setHideSuggestions(true);
}, 200);
}
const searchInput = useRef<HTMLInputElement>(null);
return (<>
@ -77,11 +81,7 @@ export const SearchControl = ({ clusterRef }) => {
ref={searchInput}
onChange={(e) => setValue(e.target.value)}
onFocus={() => setHideSuggestions(false)}
onBlur={async () => {
setTimeout(() => {
setHideSuggestions(true);
}, 200);
}} />
onBlur={() => hide()} />
<LocateControl />
</div>
{value.length > 0 && <button className="tw-btn tw-btn-sm tw-btn-circle tw-absolute tw-right-16 tw-top-2" onClick={() => setValue("")}></button>}
@ -108,10 +108,12 @@ export const SearchControl = ({ clusterRef }) => {
if (filterTags.length > 0) {
marker !== null && window.history.pushState({}, "", `/${item.layer.name}/${item.id}`)
resetFilterTags();
hide();
}
else {
marker !== null && clusterRef?.current?.zoomToShowLayer(marker, () => {
marker?.openPopup();
hide();
});
}
}