Open fancyham opened 4 months ago
Hi @hanapotski , just checked out the devla site today and there's something weird happening:
When I tap on an org pin, the pin smooth-scrolls off the screen! Very smooth, but kinda weird :)
https://github.com/hackforla/food-oasis/assets/3376957/b0198e69-a47f-4c6e-a896-7d58698ad55b
Thanks 🙏 This is a known bug. Qiqi's looking into it 👌
Still working on this, but adding notes here for future me and future team:
I believe issue is at L119 of ResultsMap.js
and L96 of Desktop.js
In Desktop.js
, the width of the Mapbox viewport is always 100% of the device width. Opening or closing the List Panel does not affect this, as the List Panel is in the z-index above the Mapbox viewport. (See images above)
In ResultsMap.js
, the center
is offset by a constant lat/long value based on whether the List Panel is open. However, these constants are only accurate for the default zoom, and won't be entirely accurate if the zoom level is changed.
const onClick = (e) => {
mapRef.current?.flyTo({
center: [
isListPanelOpen && !isMobile ? e.lngLat.lng - 0.08 : e.lngLat.lng,
isMobile ? e.lngLat.lat - 0.03 : e.lngLat.lat,
],
duration: 2000,
});
// . . .
};
Desktop.js
layout so that the mapbox width is adjusted when the List Panel is open, and remove the long/lat offsets. The same issue appears on mobile - and it’s trickier since the map viewport can change when the text panel resizes:
the above issue is very serious as it makes the mobile site very unusable
Describe the bug
Serious bug:
When viewing a list of organizations, and tapping one to get details about it, the map does not update show or highlight the organization’s pin. Often the pin is way off-screen.
The map should re-center (ideally with a smooth scroll/pan) on the highlighted pin automatically, ideally showing both the user’s current location and the pin so that they can determine the relative location.
Steps to reproduce the issue
(if applicable, please specify platform (iOS, Android, Windows, Mac version) and brower)
What's the expected result?
Map should re-center on the organization’s pin automatically, each time a new organization is viewed.
Ideally, the map smoothly pans to the new location, and ideally, the user’s current location / entered address is also visible on the map (though this may be difficult if the user has panned the map manually)
See Apple or Google maps or Yelp on mobile phones for example.
What's the actual result?
The organization’s pin may be highlighted, but is often off-screen with no indication for how to find the pin itself.
This is a regression — the previous version centered on highlighted pins properly.
Additional details / screenshot
Device configuration