From 76a1bfe6fa17cd16de8dc4b28f70f7a9ada7d1f4 Mon Sep 17 00:00:00 2001 From: archmoj Date: Fri, 27 Aug 2021 15:18:01 -0400 Subject: [PATCH 1/2] fix double click legends in toggleitem groupclick --- src/components/legend/handle_click.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/legend/handle_click.js b/src/components/legend/handle_click.js index cdde3ce01ff..8b33e4bc3c3 100644 --- a/src/components/legend/handle_click.js +++ b/src/components/legend/handle_click.js @@ -65,6 +65,8 @@ module.exports = function handleClick(g, gd, numClicks) { } function setVisibility(fullTrace, visibility) { + if(legendItem.groupTitle && !toggleGroup) return; + var fullInput = fullTrace._fullInput; if(Registry.hasTransform(fullInput, 'groupby')) { var kcont = carrs[fullInput.index]; @@ -199,7 +201,7 @@ module.exports = function handleClick(g, gd, numClicks) { // N.B. consider traces that have a set legendgroup as toggleable notInLegend = (fullData[i].showlegend !== true && !fullData[i].legendgroup); isInGroup = isClicked || (hasLegendgroup && fullData[i].legendgroup === legendgroup); - setVisibility(fullData[i], ((isInGroup && toggleGroup) || notInLegend) ? true : otherState); + setVisibility(fullData[i], (isInGroup || notInLegend) ? true : otherState); break; } } From b08f108ad69a440e334c0a3e7dc882fbb573c4d2 Mon Sep 17 00:00:00 2001 From: archmoj Date: Fri, 27 Aug 2021 15:40:11 -0400 Subject: [PATCH 2/2] log for PR 5909 --- draftlogs/#5909_fix.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 draftlogs/#5909_fix.md diff --git a/draftlogs/#5909_fix.md b/draftlogs/#5909_fix.md new file mode 100644 index 00000000000..1512648fcf4 --- /dev/null +++ b/draftlogs/#5909_fix.md @@ -0,0 +1 @@ + - Fix double click legends when `groupclick` is set to "toggleitem" [[#5909](https://github.com/plotly/plotly.js/pull/5909)]