Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup popup #6207

Merged
merged 8 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
ahuang11 marked this conversation as resolved.
Show resolved Hide resolved
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