rusackas opened a new pull request, #43075:
URL: https://github.com/apache/superset/pull/43075

   ### SUMMARY
   
   Custom (Handlebars) deck.gl tooltips never dismissed. After hovering off a 
feature, the last tooltip stayed on screen and followed the cursor around the 
map. Reported in #43069 on a Polygon chart, but it affects every deck.gl layer 
that uses a Handlebars tooltip.
   
   The shared `onHover` handler in `layers/common.tsx` only refreshed the 
tooltip content while a feature was picked, but its show/hide condition kept 
showing the tooltip whenever the content was a custom one, even when nothing 
was picked:
   
   ```js
   if (currentTooltipContent && (o.picked || 
isCustomTooltip(currentTooltipContent))) {
     setTooltip({ content: currentTooltipContent, x: o.x, y: o.y });
   }
   ```
   
   Since deck.gl keeps firing `onHover` with fresh `x`/`y` as you move over 
empty space, this re-rendered the stale last-picked content at the moving 
cursor position and never cleared it. The fix is to only show the tooltip while 
a feature is actually picked, which is what the default (non-custom) tooltip 
already did:
   
   ```js
   if (o.picked && currentTooltipContent) {
     setTooltip({ content: currentTooltipContent, x: o.x, y: o.y });
   } else {
     setTooltip(null);
     currentTooltipContent = null;
   }
   ```
   
   The custom-tooltip type check is no longer needed, so it and its unused 
`isValidElement` import were removed.
   
   ### BEFORE/AFTER
   
   Before: leaving a polygon (or any feature) left its Handlebars tooltip stuck 
to the cursor until you re-entered another feature. See the screenshots in 
#43069.
   
   After: the tooltip disappears as soon as the cursor leaves the feature, 
matching the built-in tooltip behavior.
   
   ### TESTING INSTRUCTIONS
   
   Added a regression test in `layers/common.test.ts` asserting that a custom 
tooltip is cleared (`setTooltip(null)`) on hover-out. Manually: create a 
deck.gl Polygon chart, add a Handlebars tooltip template, hover a polygon, then 
move the mouse off it — the tooltip should disappear rather than follow the 
cursor.
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: Fixes #43069
   - [ ] Required feature flags:
   - [x] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
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]

Reply via email to