plotly / plotly/plotly.js

[CHORE]: Update modebar button names to be more accurate/consistent

Aperta
#7,942 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

chore P3 plotly-internal size: 1 task
Lingua principale
JavaScript
Stelle
18.3k
Fork
2k
Merge medio
2g 12h
PR unite (30g)
28

Descrizione

Description

Update existing modebar button/group names to be more accurate/consistent.

Three related inconsistencies in how modebar buttons are named:

  • resetViewSankey reports a different name than its key. It is registered as modeBarButtons.resetViewSankey but carries name: 'resetSankeyGroup' - the only mismatch among the 37 buttons. Removing it therefore requires modeBarButtonsToRemove: ['resetSankeyGroup'], while config.modeBarButtons groups use 'resetViewSankey'.
  • _cat: 'reset' matches only resetGeo. It reads like a category but leaves resetViews, resetScale2d, resetViewMap, and the sankey reset in place.
  • _cat: 'resetView' matches only resetViewMap, so it misses the sankey reset despite the name suggesting otherwise.

All of these strings are advertised in the layout.modebar.remove enumeration (48 entries), so they are public API.

Why should this change be made?

Users reasonably expect a button's removal string to match its key, and a category alias to cover a family. Today remove: 'reset' and remove: 'resetView' silently no-op on most reset buttons, and the sankey button can only be removed by a name that appears
nowhere else. Compare the aliases that do behave as categories: zoom (2 buttons), pan (2), zoomin / zoomout (3 each), hoverclosest (4).

Scope
  • src/components/modebar/buttons.js - name on resetViewSankey, and the _cat values for reset / resetView.
  • src/components/modebar/constants.js builds foreButtons from name + _cat, so any change regenerates the schema enumeration (npm run schema, committing test/plot-schema.json and src/types/generated/schema.d.ts).
  • src/types/core/layout.d.ts - ModeBarDefaultButtons currently lists both resetViewSankey and resetSankeyGroup
Notes
  • All of these changes are breaking
  • Nothing is wrong with the current code, but it can be confusing
  • _cat casing is inconsistent (hoverCompare, resetCameraDefault, resetView vs hoverclosest, zoomin, autoscale) and should be addressed at the same time (though it's only cosmetic)
  • Every item breaks working code - renaming the sankey name invalidates modeBarButtonsToRemove: ['resetSankeyGroup'], and widening the _cat aliases makes existing remove calls take out more buttons. So this belongs in a major release; v4 is the window if it's wanted at all. Separately, _cat casing is inconsistent (hoverCompare, resetCameraDefault, resetView vs hoverclosest, zoomin, autoscale) - cosmetic only, since matching lowercases both sides.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia da src/components/modebar/buttons.js e src/components/modebar/constants.js per tracciare come i nomi dei pulsanti e i valori di _cat diventano alias di rimozione. Aggiorna i nomi e le categorie di modebar elencati, quindi esegui npm run schema e verifica che test/plot-schema.json, src/types/generated/schema.d.ts e src/types/core/layout.d.ts riflettano le modifiche all’API pubblica.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript
Ambito
data-visualization
Tipo di issue
Refactoring
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.