[Bug] Focus ring invisible when the chart has an x viewport: clip-path <defs> gets visibility="hidden"
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 75/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- accessibility, frontend
Línea de trabajo
Start by reading renderSvgClip in svg-renderer.js, then compare the focus visibility loops in motion.js and svg-surface.js. Reproduce with scales.x.viewport enabled and inspect how the focus layer's keyed defs element is handled. Done when the focus ring appears with a viewport and the clip region remains intact.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Version: @tanstack/charts 1.2.0, still present in 1.4.0
What happens
With scales.x.viewport set, the default focus ring on a lineY mark doesn't show on hover. The crosshair and tooltip work. The ring's <circle> is in the DOM with visibility="visible", but nothing is drawn.
Cause
With a viewport, the focus layer gets a clip path. renderSvgClip (svg-renderer.js) writes its <defs data-ts-key="…:clip-defs"> as a keyed child of the layer:
<g class="ts-chart__focus-layer" data-ts-focus-layer="over" clip-path="url(#…)">
<defs data-ts-key="default-focus:line-0:clip-defs" visibility="hidden">
<clipPath id="…"><rect x="44" y="4" width="700" height="178"/></clipPath>
</defs>
<circle data-ts-key="line-0:…" visibility="visible" … />
</g>
paintMotionSvgFocus (motion.js) and the same loop in svg-surface.js set visibility on every [data-ts-key] descendant of the layer, by whether its key is focused. The <defs> is never focused, so it gets hidden. The <rect> inside the clipPath inherits that. Per the SVG spec, a clip path child that isn't visible doesn't contribute to the clip, so the clip region is empty and the whole layer is clipped away.
Repro
defineChart({
marks: [lineY(data, { x: (d) => d.x, y: (d) => d.y }), crosshair({ x: true, y: false })],
scales: { x: { scale: scaleUtc, viewport: { domain: [from, to] } }, y: { scale: scaleLinear } },
focus: 'group-x',
})
Hover the plot: tooltip and crosshair appear, the ring doesn't. Remove viewport and the ring is back.
Suggested fix
Skip the clip definitions when painting focus visibility, e.g. leave out keys ending in :clip-defs or defs elements in the querySelectorAll("[data-ts-key]") loop. Alternatively, render the <defs> without a data-ts-key.
Workaround
[data-ts-focus-layer] > defs { visibility: visible; }
CSS outranks the presentation attribute.
Investigated with the help of an AI assistant; verified against the 1.2.0 and 1.4.0 dist.
- Lenguaje dominante
- TypeScript
- Estrellas
- 870
- Forks
- 57
- Merge medio
- 11 h 58 min
- PR fusionados (30 d)
- 18
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
-
[Perf] Canvas layer composition is quadratic: splitRenderLayers re-copies the node array per nodeAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
[Bug] Focus guides: `url(#id)` paints ignore `idPrefix`Posiblemente ocupada @getdownandcode la tomó hace 37 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
-
Add reverse options to waffleY and waffleXPosiblemente ocupada @tannerlinsley la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 1 día
Todos los issues de TanStack/charts
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
fb55/htmlparser2#2579 ·
Los mantenedores suelen responder en 1 día
-
bug good first issue needs-review
Dificultad 1/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día
-
Add Module DB RulesAbiertodocumentation public
Dificultad 1/5 1-3 horas Aptitud para principiantes 68/100
midnightntwrk/umbradb#65 ·
Los mantenedores suelen responder en 2 días
-
area/channels kind/bug priority/medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
nanocoai/nanoclaw#4501 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Docker images: plain X.Y.Z tag (e.g. 7.2.3) is never updated after the initial release buildAbiertoneeds verification
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 13 días