question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Disabled Buttons still call callbacks when clicked

See original GitHub issue

Button widgets, when disabled, still invoke their callback function when clicked. Using the example code below, the message ‘Start button was clicked’ can be seen in the browser console when the (disabled) button is clicked.

from bokeh.models import Button, CustomJS
from bokeh.plotting import show

callback = CustomJS(code="""
    console.log('Start Button was pressed.')
""")

button_one = Button(label="Start", disabled=True, callback=callback)
show(button_one)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
bryevdvcommented, Aug 11, 2016

IMO disabled widgets should be greyed, non-interactable, and (as a consequence) never fire callbacks. I’m not sure what “disabled” would mean otherwise.

0reactions
bryevdvcommented, Dec 21, 2016

This is actually a dupe of #1376

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tkinter(python) disabled buttons calls method - Stack Overflow
The DISABLED field of the button only controls the built-in callback for the button. If you make a separate "handmade" binding on your...
Read more >
Can I disable a button while callback is running? - Param
Help much appreciated! Welcome to the community. Great question. Yes you can disable the buttons while they are executing the associated function.
Read more >
[BUG] Unable to disable buttons in on_click callbacks #9404
I am trying to disable a button after making a search call and enable it back after the search call is successful. However,...
Read more >
Disable buttons while running callback using new dash version
Hi, I am executing a time-intensive query inside of a callback when clicking a button. During this, I am showing a loading symbol....
Read more >
The Disabled Attribute in React Buttons - Upmostly
Despite having the onClick attribute set, the first button doesn't log anything to the console when clicked. The disabled attribute prevents the onClick...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found