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

WidgetDropDown does not re-enable properly if ElementFormControl::SetDisabled(false) is set #210

Open
owlcall opened this issue Aug 24, 2014 · 2 comments
Assignees

Comments

@owlcall
Copy link

owlcall commented Aug 24, 2014

The Select and DataSelect form controls do not re-enable properly when you call SetDisabled(false). This assumes that the SetDisabled(true) was called at some point in the past. This is because WidgetDropDown sets the pseudo-class "disabled" to true (in OnLayout method), but never undoes that change for child elements - even if the disabled flag was set to false.

I fixed the issue by changing the following if statement in void WidgetDropDown::OnLayout() method:

Before:
if(parent_element->IsDisabled())
{
// Propagate disabled state to selectvalue and select arrow
value_element->SetPseudoClass("disabled", true);
button_element->SetPseudoClass("disabled", true);
}

After (added the 'else' statement):
if(parent_element->IsDisabled())
{
// Propagate disabled state to selectvalue and selectarrow
value_element->SetPseudoClass("disabled", true);
button_element->SetPseudoClass("disabled", true);
}
else
{
// Undo the disabled state change to selectvalue and selectarrow
value_element->SetPseudoClass("disabled", false);
button_element->SetPseudoClass("disabled", false);
}

This fixes the issue, and the child elements update themselves and no longer misbehave when disabling/enabling the select/dataselect controls.

Sorry if this is not the best way to submit solutions to bugs - I have no idea how to do this in github.

@dwimsey dwimsey self-assigned this Aug 24, 2014
@dwimsey
Copy link
Member

dwimsey commented Aug 24, 2014

Thanks, I'll take a look at it. My only concern out of the box is that this re-enables children without taking into account that those children may have been disabled separately. It just needs to be consistent with the behavior elsewhere in the library so I'll take a look.

Take a look at https://help.github.com/articles/using-pull-requests for info on the ideal way to submit a patch.

@owlcall
Copy link
Author

owlcall commented Aug 24, 2014

The child elements in this case are only selectvalue, and selectarrow, but I will not say 'no' to testing. Thanks for the attention and document link, much appreciated!

andreasschultes pushed a commit to andreasschultes/libRocket that referenced this issue Dec 12, 2023
… Fixes shortcut keys (eg. cut/copy/select all), see libRocket#210.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants