You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/08/11 20:22:31 UTC
(superset) branch fix/deckgl-custom-tooltip-dismiss created (now 16408bafbe2)
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a change to branch fix/deckgl-custom-tooltip-dismiss
in repository https://gitbox.apache.org/repos/asf/superset.git
at 16408bafbe2 fix(deck.gl): dismiss custom tooltips on hover-out
This branch includes the following new commits:
new 16408bafbe2 fix(deck.gl): dismiss custom tooltips on hover-out
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(superset) 01/01: fix(deck.gl): dismiss custom tooltips on hover-out
Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch fix/deckgl-custom-tooltip-dismiss
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 16408bafbe2f8fa8d01275f6c9e29fc0b098fb84
Author: Evan Rusackas <ev...@rusackas.com>
AuthorDate: Tue Aug 11 13:22:11 2026 -0700
fix(deck.gl): dismiss custom tooltips on hover-out
Handlebars (custom) deck.gl tooltips kept re-rendering the last-picked content at the cursor after leaving a feature, so the tooltip stayed on screen and followed the mouse. Only show the tooltip while a feature is picked, matching the default tooltip behavior. Fixes #43069.
Co-Authored-By: Claude Opus 4.8 <no...@anthropic.com>
---
.../preset-chart-deckgl/src/layers/common.test.ts | 27 ++++++++++++++++++++++
.../preset-chart-deckgl/src/layers/common.tsx | 15 +++++-------
2 files changed, 33 insertions(+), 9 deletions(-)
diff --git a/superset-frontend/plugins/preset-chart-deckgl/src/layers/common.test.ts b/superset-frontend/plugins/preset-chart-deckgl/src/layers/common.test.ts
index fba223082b4..fa09dc7fcb3 100644
--- a/superset-frontend/plugins/preset-chart-deckgl/src/layers/common.test.ts
+++ b/superset-frontend/plugins/preset-chart-deckgl/src/layers/common.test.ts
@@ -17,6 +17,7 @@
* under the License.
*/
+import { createElement } from 'react';
import { PickingInfo } from '@deck.gl/core';
import { JsonObject, QueryFormData } from '@superset-ui/core';
import {
@@ -131,6 +132,32 @@ describe('commonLayerProps', () => {
});
});
+ test('clears a custom tooltip on hover-out instead of trailing the cursor', () => {
+ // Regression test for a custom (Handlebars) deck.gl tooltip that stayed
+ // visible and followed the mouse after leaving a feature.
+ const setTooltip = jest.fn();
+ const customContent = createElement('div', {
+ 'data-tooltip-type': 'custom',
+ });
+ const props = commonLayerProps({
+ formData: { ...partialformData } as QueryFormData,
+ setTooltip: setTooltip as any,
+ setTooltipContent: (() => customContent) as any,
+ });
+
+ // Hovering a feature shows the custom tooltip.
+ props.onHover?.({ picked: true, x: 10, y: 20 } as any);
+ expect(setTooltip).toHaveBeenLastCalledWith({
+ content: customContent,
+ x: 10,
+ y: 20,
+ });
+
+ // Moving off the feature must dismiss it, not keep repositioning it.
+ props.onHover?.({ picked: false, x: 30, y: 40 } as any);
+ expect(setTooltip).toHaveBeenLastCalledWith(null);
+ });
+
test('calls onSelect when table_filter is enabled', () => {
const formData = {
...partialformData,
diff --git a/superset-frontend/plugins/preset-chart-deckgl/src/layers/common.tsx b/superset-frontend/plugins/preset-chart-deckgl/src/layers/common.tsx
index 3e9d8270429..2871e765ffd 100644
--- a/superset-frontend/plugins/preset-chart-deckgl/src/layers/common.tsx
+++ b/superset-frontend/plugins/preset-chart-deckgl/src/layers/common.tsx
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { ReactNode, isValidElement } from 'react';
+import { ReactNode } from 'react';
import {
ascending as d3ascending,
quantile as d3quantile,
@@ -70,19 +70,16 @@ export function commonLayerProps({
if (setTooltipContent) {
let currentTooltipContent: ReactNode = null;
- const isCustomTooltip = (content: ReactNode): boolean =>
- isValidElement(content) &&
- content.props?.['data-tooltip-type'] === 'custom';
-
onHover = (o: JsonObject) => {
if (o.picked) {
currentTooltipContent = setTooltipContent(o);
}
- if (
- currentTooltipContent &&
- (o.picked || isCustomTooltip(currentTooltipContent))
- ) {
+ // Only show the tooltip while a feature is actually hovered. Custom
+ // (Handlebars) tooltips used to stay visible and follow the cursor
+ // after hover-out because their content was kept on screen even when
+ // nothing was picked.
+ if (o.picked && currentTooltipContent) {
setTooltip({
content: currentTooltipContent,
x: o.x,