rusackas opened a new pull request, #41158:
URL: https://github.com/apache/superset/pull/41158
### SUMMARY
Fixes #37761, where the World Map hover highlight stays stuck on Chrome/Edge
(works in Firefox).
The root cause was diagnosed by @singer-cheng in the issue thread, with
cross-browser testing: the hand-written `mouseover`/`mouseout` handlers added
in #37716 duplicate Datamaps' built-in `highlightOnHover` behavior. Datamaps
already saves each country's original fill on `mouseover` (into
`data-previousAttributes`) and restores it on `mouseout`. The custom handlers
stored/restored the fill a second way (via `data-original-fill` +
`element.style('fill', ...)`), creating two competing restore paths. Their
execution order is browser-timing-dependent, so on Chrome/Edge the highlight
never resets, while Firefox happened to win the race.
This removes the redundant handlers and relies solely on the built-in path.
Datamaps applies the initial fill (including the no-data `defaultFill`) as an
inline `style('fill', ...)` on every subunit, so its save/restore is symmetric
for both data and no-data countries, which covers the original #37569/#37716
concern.
Credit to @singer-cheng for the root-cause analysis and the cross-browser
verification (Chrome/Edge/Firefox).
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable (behavioral fix). Before: hovering a country on Chrome/Edge
leaves it highlighted after the cursor moves away. After: the highlight resets
on mouse-out for both data and no-data countries.
### TESTING INSTRUCTIONS
1. Open a World Map chart (ideally with some countries that have no data) in
Chrome or Edge.
2. Hover over a country, then move the cursor away.
3. Confirm the country returns to its original fill (data color, or the
neutral no-data color) instead of staying highlighted.
4. Repeat across data and no-data countries.
Unit tests: `cd superset-frontend && npx jest
plugins/legacy-plugin-chart-world-map/test/WorldMap.test.ts`
Note: the unit suite mocks Datamaps, so it can't reproduce the native
browser-event ordering itself. The added regression test instead locks in the
fix's invariant - the chart relies on `highlightOnHover` and registers no
competing custom hover-fill handlers on the countries - and the obsolete tests
for the removed handlers were dropped. The real cross-browser behavior was
verified manually (see issue thread).
### ADDITIONAL INFORMATION
- [x] Has associated issue: Fixes #37761
- [ ] Required feature flags:
- [x] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]