MudBlazor
MudBlazor copied to clipboard
MudAutoComplete bound value not being set if user presses Tab key
Bug type
Component
Component name
MudAutoComplete
What happened?
If you type in an item which is found by the search function and immediately after press Tab to move the focus out the field without pressing enter or clicking of the item from the drop down list, the value of the bound property is not set. The same happens if you copy/paste a into the autocomplete field. Funnily enough, if you type in a value which is NOT found by the search function, the bound property is correctly set.
See attached recording
Expected behavior
The value of the bound property is set upon leaving the field. The value of the bound property is set after a copy paste
Reproduction link
https://try.mudblazor.com/snippet/GOQGOfkqHOWvXzRp
Reproduction steps
- Define an Autocomplete field with
- Type a value into the field. The value must be a known one (namely, the search function can find it)
- Press Tab to move the focus out the field (do not click on the item in the drop down list)
- Repeat from 2. but copy/paste instead of typing
Relevant log output
No response
Version (bug)
6.*
Version (working)
No response
What browsers are you seeing the problem on?
Firefox
On what operating system are you experiencing the issue?
Windows
Pull Request
- [ ] I would like to do a Pull Request
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
You need to use SelectValueOnTab
parameter.
https://try.mudblazor.com/snippet/QYGwaAceqxgLIjts
And i doesn't see any problem about paste. Could you confirm?
This is problematic. Yes you can use SelectValueOnTab to solve the issue but ONLY when using tab. If the user just clicks outside the field the value is NOT set. Even with CoerceValue set to true.
So when typing the correct string and NOT selecting it in the dropdown. Or when pasting it in, the value is not set when focus is lost without using tab or enter.
The value displays but is it not set in those cases.
Instead of SelectValueOnTab we need something like SelectValueOnLoseFocus. But I would argue that should not be nessesary when using CoerceValue.
@mckaragoz yes, that works