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
[TextField] Fix unfocused state when disabled #7283
Conversation
Out of curiosity, should it call this.blur(); in this case? this will ensure 100% the component itself is blurred then (although it really becomes so anyway). |
I'm wondering what the default behavior with a native button. I would expect the browser to trigger a blur. Maybe we should only handle that event. |
I would expect it to be the case as well, but apparently it isn't.
So my theory is that the input is actually bluring, but the event listener is disabled. |
I can confirm the behaviour https://jsfiddle.net/v23yf5yh/. looks good 👍 |
* call_em_all_-_master/master: [Docs] Add v0.18.6 to versions.json 0.18.6 [CHANGELOG] Extra information [CHANGELOG] Prepapre v0.18.6 [TextField] Fix unfocused state when disabled (mui#7283) [DatePicker] Use pickerHeaderColor muiTheme property for DatePicker header customization (mui#7295) [ListItem] Apply paddingRight to automatic expand icon (mui#7313) [AutoComplete] Fix issue with popover positioning on iOS (mui#7333)
Basically I found out that if the component is currently focused and then becomes disabled while it is then it will be stuck in focused state until it becomes enabled again.
Even then, since the blur event does not get emitted for some reason (yet it becomes blurred), then once it becomes enabled again you have to manually focus and unfocus it again for it to get the unfocused state.
This PR fixes this by making sure the focused state is set to false when disabled is set to true.