☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Disabled Buttons still call callbacks when clicked

Community Support
Toby_Hodges
Toby_Hodges

Button widgets, when disabled, still invoke their callback function when clicked. I had expected that setting Button.disabled to True would prevent the function of the button, as well as changing the appearance. 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="""
var button_disabled = button.get(‘disabled’)
console.log(‘Start Button was pressed.’)
“”")

button_one = Button(label=“Start”, disabled=True, callback=callback)
callback.args[‘button’] = button_one

show(button_one)

``

Is this intended behaviour? I understand that, of course, I could test the value of Button.disabled in my callback function, but I would expect the callback to simply not be invoked if the Button is disabled.

⌁   Link to post
Bryan
Bryan

This seems like something to be fixed, please file a GH issue for it so we can track it for a release.

Thanks,

Bryan

···

On Aug 10, 2016, at 6:15 AM, Toby Hodges <tbyhdgs@gmail.com> wrote:

Button widgets, when disabled, still invoke their callback function when clicked. I had expected that setting Button.disabled to True would prevent the function of the button, as well as changing the appearance. 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="""
    var button_disabled = button.get('disabled')
    console.log('Start Button was pressed.')
""")

button_one = Button(label="Start", disabled=True, callback=callback)
callback.args['button'] = button_one

show(button_one)

Is this intended behaviour? I understand that, of course, I could test the value of Button.disabled in my callback function, but I would expect the callback to simply not be invoked if the Button is disabled.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/c9b23594-6fbb-4515-8ffd-75def664e9cc%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post

End of archived discussion · Replies are disabled