holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.41k stars 484 forks source link

Modal does not display hv/gv objects in edge and chrome browsers #6395

Open fmfreeze opened 4 months ago

fmfreeze commented 4 months ago

A holoviews or geoviews object added to modal of a pn.template is not displayed in chromium based browsers Chrome and Edge but works fine in Firefox.

The behaviour can be reproduced with python3.10, panel=1.3.8 , holoviews=1.18.3 and geoviews=1.11.1 and the following MVPE:

import panel as pn
from geoviews import tile_sources
import holoviews as hv

class MinimalModalApp(pn.viewable.Viewer):
    def __init__(self):
        self.button = pn.widgets.Button(name="open modal")
        self.button.on_click(self.open_modal)

        self.modal = pn.Column(
            pn.pane.Markdown("### hv/gv object:"),
            self.get_worldcard(),
            self.get_points(),
            align="center")

        self.template = pn.template.FastListTemplate(
            main=[self.button],
            modal=[self.modal],
            title="MVPE - holoviews nor geoviews plot is not displayed in modal in Chromium based browsers (Chrome/Edge, Firefox works)"
        )

    def get_worldcard(self):
        return hv.Points(((1,2), (3,4))).opts(width=800, height=200)

    def get_points(self):
        return tile_sources.tile_sources["CartoEco"].opts(width=800, height=400)

    def open_modal(self, event):
        self.template.open_modal()

    def __panel__(self):
        return self.template

if __name__ == "__main__":
    app = MinimalModalApp()
    pn.serve(app, port=5006)

The output in Chrome and Edge browser is empty: grafik while in Firefox it works as expected: grafik

A non-hv/gv object like pn.pane.Markdown is displayed properly everywhere.

@ahuang11 did a short browser inspection, suspecting something may be wrong with xlim/ylim: efd02c3189ac105c7747c050df7e3e6afd1709ad

Does anybody have an idea what the source of this bug might be?

ahuang11 commented 4 months ago

It's strange because it works in:

https://huggingface.co/spaces/ahuang11/year-vs-climatology

image