Skip to content

Widget 'disabled' attribute breaks after toggling #7389

@h-croser

Description

@h-croser

ALL software version info

Software Version Info
Python 3.11.9
panel 1.5.2 (still working on 1.4.5)
bokeh 3.6.0
jupyterlab 4.2.5

Description of expected behavior and the observed behavior

Expected behaviour
Setting the disabled attribute of a widget to False should result in the widget being editable.

Observed behaviour
When the disabled attribute of widgets is set to True and then set to False, the attribute can be updated one more time and then fails to update further.

In the reproduction code below, clicking the Button named "toggle" once will see no change in disabled state. Clicking the "toggle" Button twice will see the state of the dummy widgets permanently set to disabled.

This behaviour occurs when the switching of states is done quickly (i.e. in a single function), but doesn't seem to occur when the switching is done in multiple cells of a notebook.

Complete, minimal, self-contained example code that reproduces the issue

import panel as pn
pn.extension()

dummy_button = pn.widgets.Button(name="dummy", button_type='primary')
dummy_text = pn.widgets.TextAreaInput()
toggle_button = pn.widgets.Button(name="toggle")

def toggle(_):
    dummy_button.disabled = True
    dummy_text.disabled = True
    dummy_button.disabled = False
    dummy_text.disabled = False

toggle_button.on_click(toggle)

layout = pn.Column(dummy_button, dummy_text, toggle_button)
layout.servable()

Screenshots or screencasts of the bug in action

Before first click
before_click
After first click
after_first_click
After second click
after_second_click

  • I may be interested in making a pull request to address this

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions