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

MatAutocomplete fails with tab and google autofill #614

Closed
sebestyn168 opened this issue Jun 19, 2020 · 4 comments
Closed

MatAutocomplete fails with tab and google autofill #614

sebestyn168 opened this issue Jun 19, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@sebestyn168
Copy link
Contributor

Describe the bug
Matautocomplete fails when leaving the component using the tab key (in MatBlazor 2.6.0)

To Reproduce
Go to https://www.matblazor.com/AutocompleteList
Select a value in the first automcomplete
Open Debug tools (F12)
Press Tab twice (first one enters the component, seconds leaves the component)

To Correct?
Though, I'm not sure it does not include regression, I added a check on the OnKeyDown of the BaseMatAutocompleteList

void OnKeyDown(KeyboardEventArgs ev)
{
       if (ev.Key == "Tab") return;
       ...
@sebestyn168 sebestyn168 added the bug Something isn't working label Jun 19, 2020
@sebestyn168
Copy link
Contributor Author

Describe the bug
Our users use Chrome's form-filling functionality. And when one of the fields to be filled is an autocomplete, Chrome sends key.null which crashes the component.

To Reproduce
You need to
use chrome
activate the functionality to fill Addresses (+phone, e-mail...)
have a form with an autocomplete like user name with all users and a textfield for email for example
enter the email field => let google fill the form
press F12 and see the error

To Correct
Add a check to prevent crash

 void OnKeyDown(KeyboardEventArgs ev)
{
           if (ev.Key == null || // google autofill sends null key
                ev.Key == "Tab")
                return;

@sebestyn168 sebestyn168 changed the title MatAutocomplete fails with tab MatAutocomplete fails with tab and google autofill Jun 22, 2020
@lindespang
Copy link
Collaborator

@sebestyn168 I'd say go ahead and make a pull request for this =)

@Gareth064
Copy link

Is this bug now fixed? If I was to download the latest nuget package would it have this fix in it?

@sebestyn168
Copy link
Contributor Author

Well the develop branch seems to have been merged just before the latest nuget 2.6.2 (https://www.nuget.org/packages/MatBlazor/)
So it's not official but I think it's ok

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

3 participants