Invalid state around CanBeFocused is possible. #21
Labels
bug
Something isn't working
good first issue
Good for newcomers
hacktoberfest
Good issues to contribute as part of Hacktoberfest
🐛 Bug Report
A Control has a IsFocused and a CanBeFocused property. A control could change it's CanBeFocused property after it receives Focus, allowing the Control to be in an invalid state. Currently the abstract Control class is relying on his subclasses to behave properly and not do this, which breaks proper encapsulation.
Context
The currently latest version (2020-10-23), I do not know what that version is (it sais 1.0.0 in the properties everywhere, but I don't really believe that).
Expected behavior
The CanBeFocused property should not allow setting it to an invalid state. Either refuse to set CanBeFocused to false if it's currently Focused (probably by throwing), or by Unfocusing when CanBeFocused is set to false.
To reproduce
Create a custom control, give it focus, set that it can't be focused and voila, you have a focused unfocusable object.
The text was updated successfully, but these errors were encountered: