[BUG]: Some event payload types don't match what's actually emitted

Ouverte
#8,147 3 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@darshpatel1052 y travaille déjà.

Depuis le 3/11/2026.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
68/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
javascript, typescript

Piste de recherche

Start with src/types/core/events.d.ts and compare the event interfaces with the emitted payloads listed in the issue, including the parcoords hover and unhover events. Check related tests or event definitions for these cases; done means the types represent the listed payload shapes and optional fields accurately.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

bug P2 plotly-internal size: 1
Description

Some event types in src/types/core/events.d.ts do not match the payload that plotly.js emits.

Steps to reproduce
  • Register gd.on('plotly_beforeplot', (event) => event.data) and call Plotly.newPlot. The code compiles, but event.data is undefined.
  • Register gd.on('plotly_selected', (event) => event.points) and clear a selection. The code compiles, but event is undefined.
  • Register gd.on('plotly_click', (event) => event.event.clientX) on a scatter3d plot. The code compiles, but event.event is undefined.
Notes
  • This is a follow-up to #8145
  • Required changes:
    • plotly_beforeplot: the payload is the tuple [data, layout, config], but BeforePlotEvent is an object.
    • plotly_selected: the payload is undefined when a selection is cleared, but the callback type does not allow it.
    • PlotMouseEvent.event: gl3d traces emit no event, but the field is required.
    • PlotHoverEvent.xvals and yvals: only cartesian traces set them, but both fields are required.
    • LegendClickEvent.node: the value is an SVG element, but the type is PlotlyHTMLElement.
    • Missing optional fields: xaxes, yaxes, xvals and yvals on click events, selections on plotly_selected, group and label on legend clicks, and subplotId on annotation clicks.
    • parcoords emits plotly_hover and plotly_unhover with {x, y, clientX, clientY, dataIndex, curveNumber}, with no points or event.
  • Fixing plotly_beforeplot and plotly_selected is a changes existing types and could break existing code for some users. This wouldn't be a breaking change because it falls under a bug fix.
Langage dominant
JavaScript
Étoiles
18.4k
Forks
2.1k
Merge moyen
2 j 16 h
PR mergées (30 j)
11

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de plotly/plotly.js

Toutes les issues de plotly/plotly.js

Issues similaires

Plus d'issues JavaScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.