Skip to content

Commit

Permalink
Cleanup popup (#6207)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuang11 committed May 7, 2024
1 parent ca56d1d commit 85564f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 6 additions & 6 deletions holoviews/plotting/bokeh/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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

Expand All @@ -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

Expand Down
3 changes: 2 additions & 1 deletion holoviews/tests/ui/bokeh/test_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()



Expand Down

0 comments on commit 85564f1

Please sign in to comment.