You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
panel 0.10.0, bokeh 2.2.2, Python 3.7
OS: Manjaro 20.1.2
Browsers: Firefox 82.0-0.1, Google chrome 86.0.4240.111-1 (issue observed on both)
Description of expected behavior and the observed behavior
The problem appears only when using custom templates. When clicking the button with defined js-callback, the callback is executed twice. In this example I try to open a new tab. When it happens for the first time, browser opens new tab and asks me for permission to display pop-ups. If I agree, then in the future clicking the button will open two tabs. See gif below.
When specifying no template, everything works as expected.
Complete, minimal, self-contained example code that reproduces the issue
import panel as pn
button = pn.widgets.Button(name="Button")
button.js_on_click(code='window.open("https://www.google.com/")')
tmpl = pn.Template("{% extends base %}")
tmpl.add_panel("some_name", button)
tmpl.servable() # This opens new tab twice
button.servable() # This works fine
Above code is run with
panel serve bug_example.py
Screenshots or screencasts of the bug in action
Workaround
One can use bokeh buttons to avoid this issue:
from bokeh.models import Button, CustomJS
from bokeh import events
bokeh_button = Button()
callback = CustomJS(code='window.open("https://www.google.com/")')
bokeh_button.js_on_event(events.ButtonClick, callback)
tmpl_bokeh = pn.Template("{% extends base %}")
tmpl_bokeh.add_panel("some_name", bokeh_button)
tmpl_bokeh.servable()
The text was updated successfully, but these errors were encountered:
ALL software version info
panel 0.10.0, bokeh 2.2.2, Python 3.7
OS: Manjaro 20.1.2
Browsers: Firefox 82.0-0.1, Google chrome 86.0.4240.111-1 (issue observed on both)
Description of expected behavior and the observed behavior
The problem appears only when using custom templates. When clicking the button with defined js-callback, the callback is executed twice. In this example I try to open a new tab. When it happens for the first time, browser opens new tab and asks me for permission to display pop-ups. If I agree, then in the future clicking the button will open two tabs. See gif below.
When specifying no template, everything works as expected.
Complete, minimal, self-contained example code that reproduces the issue
Above code is run with
Screenshots or screencasts of the bug in action
Workaround
One can use bokeh buttons to avoid this issue:
The text was updated successfully, but these errors were encountered: