Skip to content

Commit

Permalink
Merge pull request #6684 from plotly/fix-double-click-unhide
Browse files Browse the repository at this point in the history
Fix isolated state detection in multi legend case
  • Loading branch information
archmoj committed Jul 25, 2023
2 parents e0e79b4 + dc17d3b commit 9c9d5d0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions draftlogs/6684_fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Fix unhide isolated traces in multi legend cases (regression introduced in 2.24.3) [[#6684](https://github.com/plotly/plotly.js/pull/6684)]

2 changes: 1 addition & 1 deletion src/components/legend/handle_click.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ module.exports = function handleClick(g, gd, numClicks) {

isInGroup = (hasLegendgroup && fullData[i].legendgroup === legendgroup);

if(!isInGroup && fullData[i].visible === true && !Registry.traceIs(fullData[i], 'notLegendIsolatable')) {
if(fullData[i].legend === thisLegend && !isInGroup && fullData[i].visible === true && !Registry.traceIs(fullData[i], 'notLegendIsolatable')) {
isIsolated = false;
break;
}
Expand Down
8 changes: 8 additions & 0 deletions test/jasmine/tests/legend_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1915,6 +1915,14 @@ describe('legend interaction', function() {
Promise.resolve()
.then(click(0, 2))
.then(assertVisible([false, true, true, false, 'legendonly', true]))

// isolate it
.then(click(0, 2))
.then(assertVisible([false, true, 'legendonly', false, 'legendonly', true]))

// unhide it again
.then(click(0, 2))
.then(assertVisible([false, true, true, false, 'legendonly', true]))
.then(done, done.fail);
});
});
Expand Down

0 comments on commit 9c9d5d0

Please sign in to comment.