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

656 autofill bug #1609

Merged
merged 3 commits into from
Jul 30, 2019
Merged

656 autofill bug #1609

merged 3 commits into from
Jul 30, 2019

Conversation

benjamincharity
Copy link
Contributor

Fixes #656

  • Correctly set the autofill input for the email field
  • Pass the correct element to the autofill monitor

The incorrect element was being passed to the autofill monitor.

ISSUES CLOSED: #656
@codecov
Copy link

codecov bot commented Jul 29, 2019

Codecov Report

Merging #1609 into release will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           release    #1609      +/-   ##
===========================================
+ Coverage    98.81%   98.83%   +0.02%     
===========================================
  Files          126      126              
  Lines         4798     4797       -1     
  Branches       832      833       +1     
===========================================
  Hits          4741     4741              
  Misses          56       56              
+ Partials         1        0       -1
Impacted Files Coverage Δ
terminus-ui/input/src/input.component.ts 100% <100%> (ø) ⬆️
...s-ui/utilities/src/type-coercion/is-mouse-event.ts 100% <100%> (+33.33%) ⬆️
terminus-ui/select/src/select.component.ts 96.02% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 676f444...4dcd007. Read the comment docs.

@@ -15,6 +15,7 @@
[isRequired]="true"
[spellcheck]="false"
[autocapitalize]="false"
autocomplete="email"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what difference does it make with or without this autocomplete input?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The autocomplete attribute tells the browser what data should be used when providing autocompletion.

In my quick tests it seems that both Chrome and FF can infer this if the input has a name or type that defines email. But since this is the 'correct' way to define it, I thought it should be added.

this.autofillMonitor.monitor(this.elementRef.nativeElement).subscribe(event => {
public ngAfterViewInit(): void {
// Begin monitoring for the input autofill
this.autofillMonitor.monitor(this.inputElement.nativeElement).subscribe(event => {
this.autofilled = event.isAutofilled;
this.stateChanges.next();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably the meat of this fix...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. Mainly we were passing a reference to our component rather than the actual <input> element. Moving the setup into ngAfterViewInit just makes sure all the ngIfs are settled before using that reference.

@benjamincharity benjamincharity merged commit 8026f04 into release Jul 30, 2019
@benjamincharity benjamincharity deleted the 656-autofill-bug branch August 22, 2019 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LogInForm: Labels overlay input content when injected by the browser
3 participants