GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: add legend.groupdoubleclick to set group behavior on double-click by tisankanj · Pull Request #7997 · plotly/plotly.js

Conversation

@tisankanj

@tisankanj tisankanj commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

layout.legend.groupdoubleclick sets the group behavior for a legend double-click. A figure can now toggle a whole legendgroup on a single click and isolate one trace on a double click.

Closes #6812

Why this shape

handleItemClick read groupclick for every action, so a double click could not differ from a single click.

groupdoubleclick takes the coerced groupclick value as its default. A figure that omits the attribute keeps the current behavior.

The isolation path now honors the resolved group value. This corrects one existing case. With groupclick: 'toggleitem' and the default itemdoubleclick: 'toggleothers', a double click now isolates the clicked trace instead of its whole legendgroup. The old output contradicted the description of toggleitem, which toggles "the individual item clicked on the graph". I flag that correction here for your judgment.

groupclick still drives the draw-time branches in get_legend_data.js and draw.js. A draw cannot depend on a later click.

Tests

Suite: test/jasmine/tests/legend_test.js

npm run test-jasmine -- legend --nowatch

Result on my machine, Chrome 151: TOTAL: 128 SUCCESS.

New specs:

  • legend defaults - groupdoubleclick follows groupclick, and it also coerces on its own
  • legend interaction - legendgroup visibility case of groupdoubleclick: "toggleitem", one spec for the double click and one for the single click

I put the old isolation line back and ran the suite again. That run reported TOTAL: 1 FAILED, 127 SUCCESS, so the new spec covers the change.

No new mock, and no baseline moves. The attribute changes no drawn output before a user double-clicks.

Rendered check

I loaded the local bundle and compared two figures that hold the same four traces. Trace 1 and trace 3 share legendgroup: 'foo'. Trace 0 is visible: false.

Figure visible after a double click on trace 3
default [false, true, "legendonly", true]
groupdoubleclick: 'toggleitem' [false, "legendonly", "legendonly", true]

The two figures render the same before the double click. A second double click restores [false, true, true, true].

Checks

Command Result
npm run lint pass
npm run typecheck pass
npm run test-syntax pass
npm run schema-typegen-diff-check pass

Note

traceIndicesInGroup in handle_click.js takes a value that no line reads. That predates this change, so I left it alone.

🐦


Tisankan Jeyakumar
Developed and verified

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
tisankanj added 2 commits August 29, 2026 19:27
@tisankanj
feat: add legend.groupdoubleclick to set group behavior on double-click
79eba45
handleItemClick read groupclick for every action, so a double click could
not differ from a single click. A figure could not keep togglegroup on a
single click and isolate one trace on a double click.

groupdoubleclick takes the coerced groupclick value as its default, so a
figure that omits the attribute keeps the current behavior. The isolation
path now honors the resolved group value, which corrects the case where
groupclick is toggleitem and the double click still isolated a whole
legendgroup.

Closes plotly#6812
@tisankanj
docs: add draftlog for the groupdoubleclick attribute
78549d2
@camdecoster camdecoster assigned emilykl Aug 31, 2026
emilykl
emilykl reviewed Sep 4, 2026
View reviewed changes
Comment thread test/jasmine/tests/legend_test.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

emilykl
emilykl reviewed Sep 4, 2026
View reviewed changes
Comment thread test/jasmine/tests/legend_test.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

emilykl
emilykl reviewed Sep 4, 2026
View reviewed changes
Comment thread draftlogs/7997_add.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

@emilykl
increase test coverage
fabdfdc
Co-authored-by: Emily KL <[email protected]>
emilykl
emilykl approved these changes Sep 4, 2026
View reviewed changes

@emilykl emilykl left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @rascal-sl, this looks good! 🎉

For the record, while testing this PR, we did notice that it's not necessarily always obvious what the behavior of various '*click' legend properties should be when used in combination.

However that's probably a topic to be addressed in a different PR. The implementation of 'groupdoubleclick' is consistent with how 'groupclick' works, so it follows the existing pattern and seems fine to merge.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@emilykl
emilykl merged commit 3efeee4 into plotly:main Sep 4, 2026
407 of 414 checks passed

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@emilykl emilykl emilykl approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@emilykl emilykl

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

add 'toggleitem' for layout.legend.groupdoubleclick

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@tisankanj @emilykl
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.