[CHORE]: Update modebar button names to be more accurate/consistent
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 18.3k
- Forks
- 2k
- Ø Merge
- 2 T. 12 Std.
- Gemergte PRs (30 T.)
- 28
Beschreibung
Description
Update existing modebar button/group names to be more accurate/consistent.
Three related inconsistencies in how modebar buttons are named:
resetViewSankeyreports a differentnamethan its key. It is registered asmodeBarButtons.resetViewSankeybut carriesname: 'resetSankeyGroup'- the only mismatch among the 37 buttons. Removing it therefore requiresmodeBarButtonsToRemove: ['resetSankeyGroup'], whileconfig.modeBarButtonsgroups use'resetViewSankey'._cat: 'reset'matches onlyresetGeo. It reads like a category but leavesresetViews,resetScale2d,resetViewMap, and the sankey reset in place._cat: 'resetView'matches onlyresetViewMap, 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-nameonresetViewSankey, and the_catvalues forreset/resetView.src/components/modebar/constants.jsbuildsforeButtonsfromname+_cat, so any change regenerates the schema enumeration (npm run schema, committingtest/plot-schema.jsonandsrc/types/generated/schema.d.ts).src/types/core/layout.d.ts-ModeBarDefaultButtonscurrently lists bothresetViewSankeyandresetSankeyGroup
Notes
- All of these changes are breaking
- Nothing is wrong with the current code, but it can be confusing
_catcasing is inconsistent (hoverCompare,resetCameraDefault,resetViewvshoverclosest,zoomin,autoscale) and should be addressed at the same time (though it's only cosmetic)- Every item breaks working code - renaming the sankey
nameinvalidatesmodeBarButtonsToRemove: ['resetSankeyGroup'], and widening the_cataliases makes existingremovecalls take out more buttons. So this belongs in a major release; v4 is the window if it's wanted at all. Separately,_catcasing is inconsistent (hoverCompare,resetCameraDefault,resetViewvshoverclosest,zoomin,autoscale) - cosmetic only, since matching lowercases both sides.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne in src/components/modebar/buttons.js und src/components/modebar/constants.js damit nachzuverfolgen, wie Button-Namen und _cat-Werte zu Entfernungsaliasen werden. Aktualisiere die aufgeführten modebar-Namen und -Kategorien, führe anschließend npm run schema aus und überprüfe, dass test/plot-schema.json, src/types/generated/schema.d.ts und src/types/core/layout.d.ts die Änderungen an der öffentlichen API widerspiegeln.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript
- Bereich
- data-visualization
- Issue-Typ
- Refactoring
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 48/100