When using multiple Plotly charts as sticky figures inside a single .cr-section, hover tooltips stop working for all charts except the last one. Only the final sticky plot in the section shows interactive hover information.
This happens with plain plotly::plot_ly() as well as ggplotly(), and appears to be related to how Closeread manages sticky containers.
Steps to reproduce
Create a minimal Quarto document using closeread-html and multiple sticky Plotly charts:
---
title: "Closeread + Plotly hover test"
format: closeread-html
execute:
echo: false
warning: false
message: false
---
:::{.cr-section}
Hover over the points on the right and note there is no hoverinfo. @cr-plot1
:::{#cr-plot1}
```{r}
library(plotly)
plot_ly(
data = mtcars,
x = ~hp,
y = ~mpg,
type = "scatter",
mode = "markers"
)
```
:::
Now hover over the points on the right and note the hover info works properly. @cr-plot2
:::{#cr-plot2}
```{r}
library(plotly)
plot_ly(
data = mtcars,
x = ~wt,
y = ~mpg,
type = "scatter",
mode = "markers"
)
```
:::
:::
Expected behavior
All sticky Plotly charts should show hover tooltips when mousing over data points.
Actual behavior
Only the last Plotly chart in the .cr-section shows hover tooltips. Earlier sticky plots do not respond to hover.
When using multiple Plotly charts as sticky figures inside a single
.cr-section, hover tooltips stop working for all charts except the last one. Only the final sticky plot in the section shows interactive hover information.This happens with plain
plotly::plot_ly()as well asggplotly(), and appears to be related to how Closeread manages sticky containers.Steps to reproduce
Create a minimal Quarto document using
closeread-htmland multiple sticky Plotly charts:Expected behavior
All sticky Plotly charts should show hover tooltips when mousing over data points.
Actual behavior
Only the last Plotly chart in the
.cr-sectionshows hover tooltips. Earlier sticky plots do not respond to hover.