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

Offen
#8,147 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@darshpatel1052 arbeitet bereits daran.

Seit 03.11.2026.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
68/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.
Vorherrschende Sprache
JavaScript
Sterne
18.4k
Forks
2.1k
Ø Merge
2 T. 16 Std.
Gemergte PRs (30 T.)
11

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus plotly/plotly.js

Alle Issues in plotly/plotly.js

Ähnliche Issues

Weitere Issues zu JavaScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.