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

Bug when enabling/disabling container components #762

Closed
jhickman opened this issue Feb 7, 2023 · 0 comments
Closed

Bug when enabling/disabling container components #762

jhickman opened this issue Feb 7, 2023 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jhickman
Copy link

jhickman commented Feb 7, 2023

When using a container such as a ButtonsGroup, the DisableUtil is used to query FOCUSABLE_ELEMENTS children and disable/enable.

However, if disabling the container component multiple times, it puts the children in a state where they have to be enabled twice before they actually enable.

Scenario:
ButtonsGroup containing 2 buttons

  • call .disable() on the group. call enable() on the group. All is fine
  • call .disable() on the group. call disable() on the group again. call enable() on the group; buttons are not enabled. call enable() again on the group and then the buttons are enabled

This behavior is due to the logic in the DisableUtil.disableChild method. Calling disable on a parent will double disable the children. On the first time disabling, it adds the “disabled” attribute and "disabled" css class to the children. The second time, if child.isDisabled() it adds the dui-disabled attribute.

When enabling, it sees the dui-disabled attribute and removes it; but doesn’t remove the ‘disabled’ attribute and ‘disabled’ css class.

For a workaround, I'm having to double up on my enable/disable calls on the parent container component. This ensures that the children disable state is handled correctly.

buttonsGroup.setDisabled(disabled);
buttonsGroup.setDisabled(disabled);
@vegegoku vegegoku self-assigned this Feb 8, 2023
@vegegoku vegegoku added the bug Something isn't working label Feb 8, 2023
@vegegoku vegegoku added this to the 1.0.0-RC18 milestone Feb 8, 2023
@vegegoku vegegoku closed this as completed Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants