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

js_on_click not working for Button inside FloatPanel #5373

Closed
MarcSkovMadsen opened this issue Aug 6, 2023 · 0 comments · Fixed by #5433
Closed

js_on_click not working for Button inside FloatPanel #5373

MarcSkovMadsen opened this issue Aug 6, 2023 · 0 comments · Fixed by #5433
Labels
type: bug Something isn't correct or isn't working
Milestone

Comments

@MarcSkovMadsen
Copy link
Collaborator

panel==1.2.1

In https://discourse.holoviz.org/t/copy-to-clipboard-js-callback-on-a-floatpanel-not-working/5831 Monodera reports that he cannot get copy to clipboard working for a Button inside the FloatPanel.

I've reduced the example to

import panel as pn


def copy_to_clipboard_in_floatpanel():
    copy_source_button = pn.widgets.Button(
        name="✂ Copy Source Value", button_type="success"
    )
    copy_source_code = "console.log('allo')"
    copy_source_button.js_on_click(
        code=copy_source_code
    )
    return pn.layout.FloatPanel(copy_source_button, name="Float")
    # return pn.Column(copy_source_button, )


copy_to_clipboard_in_floatpanel().servable()

If you click the button, I would expect allo to be printed in the browser console. But it is not.

If you place the copy_source_button inside a Column (commented out code line), it works.

@MarcSkovMadsen MarcSkovMadsen added the type: bug Something isn't correct or isn't working label Aug 6, 2023
@MarcSkovMadsen MarcSkovMadsen added this to the next milestone Aug 6, 2023
@MarcSkovMadsen MarcSkovMadsen changed the title js_on_click not working for Button inside FloatPanl js_on_click not working for Button inside FloatPanel Aug 6, 2023
@philippjfr philippjfr modified the milestones: next, v1.2.2 Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't correct or isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants