weather-gov / weather.gov

weather.gov 2.0
Other
325 stars 8 forks source link

Radar map click moves the map marker but doesn't change page data #1164

Open coreypieper opened 4 months ago

coreypieper commented 4 months ago

When a user clicks on the radar map in the Current tab, the marker on the map moves, but nothing else changes on the page. We had user feedback that noted, "I do like the prominence of the radar, and I like that it also functions as the click map for the point forecast," but that is not the case.

greg-does-weather commented 3 months ago

What should happen? Should clicking the radar redirect to another page (like the click map), or should it do nothing (not move the marker)?

greg-does-weather commented 3 months ago

Per conversation in Slack, the correct behavior is to do nothing on map click. So we need to fiddle with the CMI map to disable the thing where it moves the marker and re-centers the map.

greg-does-weather commented 3 months ago

The CMI library provides a layer of abstraction that hides the click event handlers from us entirely. Without any updates to the CMI library, our only option is to intercept the event on the capture flow and disable it from continuing to propagate. However, that also disables all events that require clicking, such as zooming and panning.


Context

Javascript events are attached to an element on the page. Activating the event causes a whole cascade of event handlers to fire, which allows maximum flexibility in how to handle it. First, any ancestor elements that registered that event handler with the capture property will be called, starting at the page (furthest ancestor) and progressing down the tree towards the actual element. Then, the element's own event handler is called. Finally, the element's ancestor event handlers that do not have the capture property are called.

Any event handler along the way can stop the event from going any further. In that way, an ancestor to a target element can suppress events on the target by registering as capture handlers and canceling the event. The target element can also suppress events on its ancestors by canceling the event.

colinmurphy01 commented 3 months ago

Slack convo

colinmurphy01 commented 2 months ago

Splitting off CMI Library would give us option to add this and make it work.

Also dependent on map library

colinmurphy01 commented 2 weeks ago

I'm interested to see when we start going into county/state users if navigating the site via map is important to them.