data.onclick hander does not work in Firefox (v47) when chart SVG is transformed
- Dominant language
- JavaScript
- Stars
- 9.3k
- Forks
- 1.4k
- Avg merge
- 6d 16h
- Merged PRs (30d)
- 1
Description
c3 version: 0.4.11
When the SVG is transformed and shifted using CSS, onclick handler does not get triggered.
I created a jsfiddle for a chart that is shifted using transform: translate(...) to reproduce the error: https://jsfiddle.net/ka632eu5/1/
To reproduce on Firefox browser (currently using ESR v45.8)
- Open console and click on any data; onclick handler is not triggered and nothing happens (error)
- remove/uncomment css for the SVG transform and rerun; now click handler works (console.log shows)
Tested to not work on Firefox (v45) but seems to work on Chrome (using v56)
From debugging, this seems to be caused by the onclick handler on `c3_chart_internal_fn.generateEventRectsForMultipleXs(...)` using `d3.mouse(this)` to get position of the click. This doesn't seem localized to the transformed SVG.
Workaround for now is to avoid doing transform on the SVG element.
This issue also seems to be related to this d3 issue: https://github.com/d3/d3/issues/90
Contributor guide
Assessment
This issue has not been assessed yet.