Mouse position is wrong when style:zoom is applied on the plotly-graph-div

I’ve come across a problem with the hover info and selection positioning when using style:zoom on a plotly-graph created with the full_html=False statement.

The style:zoom function is used for example on a reveal.js-presentation, where several plotly graphs are included as div-objects instead of iframes. Since I can reproduce it without any code from that project, I posted it here.

I’ve uploaded a minimal example her:

The graph itself is just the example scatter plot:

    import as px
    df =  # iris is a pandas DataFrame
    fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species",
                     size='sepal_length', hover_data=['petal_width'])
    fig.write_html(file="test_petal.html", full_html=False,  include_plotlyjs=False ,default_width= "1200px", default_height="800px")

The outer div-element got the zoom, the rest is a minimal html file.

        <meta charset="utf-8">
        <title>Zoom problem</title>
		<script src=""></script>     
		<div style="width: 1280px; height: 800px; zoom: 1.35754;">	
		      <div id="xxx" class="plotly-graph-div js-plotly-plot" style="height:800px; width:1200px; ">...  </div> 


The resulting offset is visible here:

Any idea on how to solve this? The only workaround I know so far is just not using zoom.
Thank in advance

As you can see above, I’m using the latest version:

<script src=""></script>     

The code itself at the codepen example was also generated with the latest version (5.7.0)

The bug I’m describing is not limited to a specific combination of packages. It occurs whenever plotly grapgh are zoomed. The part <div style="zoom: 1.x;"> is just to make it easier to debug. It might be the result of a varity of styling and layout options.

If you need any more information or if I can assist in the debugg, just let me know.

I’ve posted the same issue on GitHub: Mouse position is wrong when style:zoom is applied on the plotly-graph-div · Issue #6169 · plotly/plotly.js · GitHub