Skip to content

onClick on options disables onClick on legend #8458

Description

@stockiNail

Expected Behavior

You can set onClick function in the options to catch events on chart area, as following:

options: {
    responsive: true,
    onClick() {
       console.log("click");
     },
     plugins: {
       legend: {
         display: true
       }
    }
}

The expectation is that the legend is continuing working as usual, hiding/showing the datasets.

Current Behavior

With the above configuration, the legend doesn't work anymore and all events are caught by the onClick function set at options level.

Steps to Reproduce

https://codepen.io/stockinail/pen/pogRZEb

Environment

  • Chart.js version: dist/master
  • Browser name and version: FF 85.0.2

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions