I noticed, that you can’t change the toggle state of a ToggleButton when disabled. Of course the user can’t and shouldn’t be able to by clicking, but calling button.setToggleState(...) was working in the past and I would expect it to.
I was the one who reported that original issue, and I agree with you. Thanks for finding that!
I hadn’t noticed this side-effect yet, but now, if you load a preset that has a togglebox disabled, it can show the wrong state - i.e. previous preset has the box enabled and checked; new preset has the box disabled and unchecked, but changing to it now leaves the box checked and disabled.
And actually, for me this is a big issue, because I can switch my interface between one of several “modules” having the same parameters, and depending on the disabled states, the ToggleButtons frequently end up displaying the wrong state.
This behaviour seems wrong to me. I think you should be able to set any control to any state whether it’s disabled or not - it’s up to the coder whether they want to process the state change when the control is disabled.
@leehu - can’t agree. If the component is disabled, you are saying to the user “you cannot modify this at this time”. So allowing him to edit it, when editing it in the current state may cause undefined behaviour, and then you have to ignore it and return the control to the previous state, doesn’t make sense. Disabled means “you can’t edit it.”
That is different from allowing your code to change the state while it is disabled.
Yes I agree - disabled state should disable all user interactions (mouse, keyboard, etc.) but should otherwise behave the same on the backend including sending notifications when the state is changed programatically.
I like how this kind of accessibility-related scenario invites us to rethink UI patterns we’re used to. Here, there’s an issue because we want to programmatically change the state of a component that explicitly says: “I have a state (toggled) and I can perform an action to change my own state; however, I’m also in a disabled state, so that action can’t be realistically performed in any meaningful way.”
If this behaviour is really desired, then it should be implemented using two separate components: one for the toggling action (e.g. a momentary switch button), which can be disabled if needed, and one for the state representation (e.g. a light indicator). In that case, it becomes clear that state and action are distinct. Accessibility is also naturally addressed this way.
That being said, I just discovered that an old app of mine is impacted by this commit, and I pulled my hair out as well But I still think this is a good invitation to rethink this UI pattern. Maybe the commit could be reverted, but with a warning about this bad practice?