c3js / c3js/c3

Legend event method customization does not provide consistent behavior

Open
#1,208 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
9.3k
Forks
1.4k
Avg merge
6d 16h
Merged PRs (30d)
1

Description

When customizing the methods for a legend, providing a new `onclick` method completely overrides the default click behavior
e.g.

```
if (config.legend_item_onclick) {
config.legend_item_onclick.call($$, id);
} else {
//...
}
```

However, the corresponding `mouseover` and `mouseout` events do not conform to this same behavior, they instead perform their default action AND the custom action.
e.g.

```
$$.d3.select(this).classed(CLASS.legendItemFocused, true);
if (!$$.transiting && $$.isTargetToShow(id)) {
$$.api.focus(id);
}
if (config.legend_item_onmouseover) {
config.legend_item_onmouseover.call($$, id);
}
```

This makes it difficult to truly provide a custom implementation of the legend since you are always getting some of the default behavior. Specifically this makes customizing the behavior on a touch-screen device difficult because you do not get the same `mouseover`->`mouseout` transition you get with mouse-based devices.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.