Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

datepicker: cannot set autocomplete property in generated input tag #11851

Open
TheManuz opened this issue Jan 29, 2020 · 3 comments
Open

datepicker: cannot set autocomplete property in generated input tag #11851

TheManuz opened this issue Jan 29, 2020 · 3 comments
Labels
P4: minor Minor issues. May not be fixed without community contributions. type: enhancement
Milestone

Comments

@TheManuz
Copy link

TheManuz commented Jan 29, 2020

Bug

Detailed Reproduction Steps:

  1. Create an md-datepicker, nested inside an md-input-container, nested inside a form.
  2. Assign a name property to md-datepicker ("releaseDate" and "expirationDate" in my case)
  3. Have Chrome autofill enabled with autocomplete fields available (specifically "email" in my case)

What is the expected behavior?

Autofill should not try to populate a datepicker.

md-datepicker should have an attribute like md-input-autocomplete that should set the "autocomplete" attribute and value in the generated input tag.
An alternative could be to disable autocomplete behaviors entirely (not sure how).

What is the current behavior?

Chrome will suggest to autofill the md-input generated by the md-datepicker with an email (in my case, but this may vary).

What is the use-case or motivation for changing an existing behavior?

If a user wants to autofill other fields of the form, the datepicker will be populated with wrong data.

Which versions of AngularJS, Material, OS, and browsers are affected?

  • AngularJS: 1.7.9
  • AngularJS Material: 1.1.12
  • OS: Mac OS High Sierra 10.13.6
  • Browsers: Chrome

Is there anything else we should know? Stack Traces, Screenshots, etc.

Nothing relevant

@Splaktar
Copy link
Member

Splaktar commented Feb 1, 2020

What value would you assign in this case? The autocomplete attribute doesn't have any date-related values other than birth dates.

Do you just want to set autocomplete="off"?

@Splaktar Splaktar added needs: demo A CodePen demo or GitHub repository is needed to demonstrate the reproduction of the issue needs: more info The issue does not contain enough information for the team to determine if it is a real bug needs: feedback The issue creator or community need to respond to questions in this issue and removed needs: more info The issue does not contain enough information for the team to determine if it is a real bug labels Feb 1, 2020
@TheManuz
Copy link
Author

TheManuz commented Feb 2, 2020

I found in my tests that autocomplete="off" doesn't work anymore.
The new (hacky) way is to set autocomplete="new-search".

I've asked to explicitly propagate the parameter on the compiled <input> just to be future proof, in the eventuality that autocomplete="new-search" stop working again with a future update.

@Splaktar Splaktar removed needs: feedback The issue creator or community need to respond to questions in this issue needs: demo A CodePen demo or GitHub repository is needed to demonstrate the reproduction of the issue labels Feb 14, 2020
@Splaktar
Copy link
Member

OK, I think that it would be reasonable to accept a PR to add a new md-datepicker-autocomplete API for doing this. We're mostly relying on the community to send PRs for enhancements at this time as we're focused on fixing high priority bugs/a11y issues/perf problems only.

@Splaktar Splaktar added for: external contributor P4: minor Minor issues. May not be fixed without community contributions. labels Feb 14, 2020
@Splaktar Splaktar added this to the - Backlog milestone Feb 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P4: minor Minor issues. May not be fixed without community contributions. type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants