posit-dev / positron

Positron, a next-generation data science IDE
Other
1.65k stars 43 forks source link

Plots: HTML content still displays, even when plots pane is closed #2170

Open isabelizimm opened 5 months ago

isabelizimm commented 5 months ago

Positron Version:

positron dev, main, as of commit 4cde239f31cfe3b7f773efdc683b71032f530643

Steps to reproduce the issue:

  1. create HTML plot, eg
import plotly.express as px
fig = px.bar(x=["a", "b", "c"], y=[1, 3, 2])
fig
  1. Collapse variables pane
  2. toggle plots pane

https://github.com/posit-dev/positron/assets/54685329/65028707-2ded-4664-8d16-c4251f41ec15

What did you expect to happen?

no plot when pane closed. this only seems to occur when the Variables pane is also closed.

juliasilge commented 5 months ago

This happens in R too, for example with leaflet or plotly:

library(plotly)
fig <- plot_ly(midwest, x = ~percollege, color = ~state, type = "box")
fig
jmcphers commented 5 months ago

Happens because these are overlay webviews, which need to be very carefully torn down so they don't float everywhere...

isabelizimm commented 4 months ago

Adding an example of the weirdness that can occur, which makes the sidebar unusable until I restart Positron. I believe this is related?

  1. start with Variables pane and Plots pane closed
  2. Create plot/variables
  3. Close plots pane
  4. Open, then close Variables pane

https://github.com/posit-dev/positron/assets/54685329/8f6b639f-b652-46d3-85e9-655388fe3502