diff --git a/holoviews/plotting/bokeh/callbacks.py b/holoviews/plotting/bokeh/callbacks.py index 02a5d8ccab..82698dbf73 100644 --- a/holoviews/plotting/bokeh/callbacks.py +++ b/holoviews/plotting/bokeh/callbacks.py @@ -693,15 +693,16 @@ def _process_selection_event(self): if popup is None: if self._panel.visible: self._panel.visible = False - if self._existing_popup and not self._existing_popup.visible: - self._existing_popup.visible = False return if event is not None: position = self._get_position(event) else: position = None + popup_pane = panel(popup) + if not popup_pane.visible: + return if not popup_pane.stylesheets: self._panel.stylesheets = [ @@ -723,8 +724,7 @@ def _process_selection_event(self): if self._existing_popup and not self._existing_popup.visible: if position: self._panel.position = XY(**position) - self._existing_popup.visible = True - if self.plot.comm: + if self.plot.comm: # update Jupyter Notebook push_on_root(self.plot.root.ref['id']) return @@ -734,13 +734,13 @@ def _process_selection_event(self): code=""" export default ({panel}, event, _) => { if (!event.visible) { - panel.position.setv({x: NaN, y: NaN}) + panel.visible = false; } }""", )) # the first element is the close button self._panel.elements = [self._panel.elements[0], model] - if self.plot.comm: + if self.plot.comm: # update Jupyter Notebook push_on_root(self.plot.root.ref['id']) self._existing_popup = popup_pane diff --git a/holoviews/tests/ui/bokeh/test_callback.py b/holoviews/tests/ui/bokeh/test_callback.py index b1cb47d4d4..93eb11de3a 100644 --- a/holoviews/tests/ui/bokeh/test_callback.py +++ b/holoviews/tests/ui/bokeh/test_callback.py @@ -284,12 +284,13 @@ def hide(_): # initial appearance locator = page.locator(".bk-btn") expect(locator).to_have_count(2) + expect(locator.first).to_be_visible() # click custom button to hide locator = page.locator(".custom-button") locator.click() locator = page.locator(".bk-btn") - expect(locator).to_have_count(0) + expect(locator.first).not_to_be_visible()