Skip to content

Commit 9c9d5d0

Browse files
authored
Merge pull request #6684 from plotly/fix-double-click-unhide
Fix isolated state detection in multi legend case
2 parents e0e79b4 + dc17d3b commit 9c9d5d0

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

Diff for: draftlogs/6684_fix.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Fix unhide isolated traces in multi legend cases (regression introduced in 2.24.3) [[#6684](https://github.com/plotly/plotly.js/pull/6684)]
2+

Diff for: src/components/legend/handle_click.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ module.exports = function handleClick(g, gd, numClicks) {
198198

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

201-
if(!isInGroup && fullData[i].visible === true && !Registry.traceIs(fullData[i], 'notLegendIsolatable')) {
201+
if(fullData[i].legend === thisLegend && !isInGroup && fullData[i].visible === true && !Registry.traceIs(fullData[i], 'notLegendIsolatable')) {
202202
isIsolated = false;
203203
break;
204204
}

Diff for: test/jasmine/tests/legend_test.js

+8
Original file line numberDiff line numberDiff line change
@@ -1915,6 +1915,14 @@ describe('legend interaction', function() {
19151915
Promise.resolve()
19161916
.then(click(0, 2))
19171917
.then(assertVisible([false, true, true, false, 'legendonly', true]))
1918+
1919+
// isolate it
1920+
.then(click(0, 2))
1921+
.then(assertVisible([false, true, 'legendonly', false, 'legendonly', true]))
1922+
1923+
// unhide it again
1924+
.then(click(0, 2))
1925+
.then(assertVisible([false, true, true, false, 'legendonly', true]))
19181926
.then(done, done.fail);
19191927
});
19201928
});

0 commit comments

Comments
 (0)