bug(tooltip): Popover portal does not reset UA border, background, and backdrop when using custom tooltip bodies
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 20/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- html, react, typescript
Línea de trabajo
Start with packages/charts-core/tooltip-portal.ts and tooltip.ts, where the issue identifies the popover resets and inline tooltip styles. Check how renderTooltipBody is handled and run the relevant chart-core tests, if available. Done when custom tooltip bodies no longer inherit unwanted wrapper card styles and the popover backdrop is hidden; a linked pull request is already open.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
When using @tanstack/charts with portal and a custom React tooltip body (renderTooltipBody), the outer container element renders an unwanted border, white/canvas background, padding, box shadow, and in some browsers a backdrop.
This happens due to two issues in packages/charts-core:
- Missing Popover UA Resets: In
tooltip-portal.ts, whenelement.setAttribute("popover", "manual")is called, modern browsers apply their default User-Agent stylesheet rules for:popover-open(border: 2px solid,background-color: Canvas,padding: 0.25em) and create a::backdroppseudo-element.tooltip-portal.tsonly setsposition: fixed,margin: 0, but does not neutralizeborder,background,outline,padding, or::backdrop. - Hardcoded Inline Card Styles on Custom Tooltips: In
tooltip.ts(createTooltip),tooltipElement.stylehas hardcoded inline styles (background: Canvas,border: 1px solid ...,boxShadow: ...,padding: ...). When a consumer provides their own<ChartTooltip />component viarenderTooltipBody, these high-specificity inline styles leak around the custom card, forcing users to use!importantCSS overrides.
Minimal Reproduction
import { defineChart, lineY } from "@tanstack/charts";
import { Chart } from "@tanstack/charts/react/tooltip";
import { portal } from "@tanstack/charts/tooltip/portal";
import { tooltip } from "@tanstack/charts/tooltip";
const chart = defineChart({
marks: [lineY(data, { x: "time", y: "value" })],
tooltip: {
portal,
use: tooltip,
},
});
export function TelemetryChart() {
return (
<Chart
definition={chart}
renderTooltipBody={({ points }) => (
// Custom styled tooltip card
<div className="rounded-lg border border-zinc-200 bg-zinc-900 p-2 text-white">
Value: {points[0].yValue}
</div>
)}
/>
);
}
Expected Behavior
When renderTooltipBody is passed, or when portal uses the HTML Popover API:
- The outer popover wrapper element (
.ts-chart-tooltip) should act as an unstyled positioning anchor without default card borders, canvas backgrounds, or padding. - The popover's
::backdropshould be hidden by default (display: none).
Actual Behavior
The custom tooltip card is wrapped in a container that displays:
- The browser's native popover border and
Canvasbackground color. - TanStack Charts' default card padding, border, and box-shadow inline styles.
Suggested Fix
- In
tooltip-portal.ts, reset UA popover styles (border: "none",background: "transparent",padding: "0",outline: "none") and inject a backdrop reset stylesheet. - In
tooltip.ts, resettooltipElement.stylewhencustomis true (renderTooltipBodyis active).
I am opening a PR with this fix.
- Lenguaje dominante
- TypeScript
- Estrellas
- 842
- Forks
- 53
- Merge medio
- 4 h 40 min
- PR fusionados (30 d)
- 16
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de TanStack/charts
-
[Bug] Focus guides: `url(#id)` paints ignore `idPrefix`Posiblemente ocupada @getdownandcode la tomó hace 7 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
TanStack/charts#211 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Bug] Printed charts keep their screen width: resize redraw waits for an animation framePosiblemente ocupada @piecyk la tomó hace 6 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
-
[Feature] Readable outside labels for crowded pie and donut chartsPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
TanStack/charts#227 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 42/100
TanStack/charts#216 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 57/100
Los mantenedores suelen responder en 1 día
Todos los issues de TanStack/charts
Issues similares
-
engine-rs P3 review-deferral wasm
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
maniator/verticopolis#1154 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
telerik/kendo-react#3861 ·
Los mantenedores suelen responder en 1 día
-
[bug]: use-mobile.ts uses pixel logic, causing UI state de-sync with Tailwind CSS rem breakpointsAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
task
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100