highcharts / highcharts

Highcharts JS, the JavaScript charting framework
https://www.highcharts.com
Other
11.98k stars 3.6k forks source link

Click and hover events pass through x-axis #21136

Open fidian opened 4 months ago

fidian commented 4 months ago

Expected behaviour

I have a scollable bar chart and there are items hiding under the x-axis. When I hover over the x-axis or click on the x-axis, the click should be ignored because the bars in that area are not visible.

Actual behaviour

Clicks trigger selections of rows (not shown in the demo). Hover events still trigger popups in the x-axis (shown in demo). Right-clicking in the spot shows the bar in the SVG as the topmost element.

image

Live demo with steps to reproduce

https://jsfiddle.net/jo3vm6s1/

This does not implement selection of items, but does show how the cursor events are triggering things for bars that are not visible.

Product version

Affected browser(s)

Chrome.

karolkolodziej commented 4 months ago

Hi @fidian! Thank you for reaching out!

You are right with opacity: 1, it doesn't make much sense- see the simplified demo. image

But with a default one, it looks better but still, I'm not sure if this is correct. image

It has been working like this since the get-go, any comments @TorsteinHonsi?

TorsteinHonsi commented 4 months ago

@karolkolodziej I think it's a bug. It should be trivial (famous last words) to check the click coordinates or the target point for chart.isInsidePlot.