PER-9982 hitting enter submit 2fa code#530
Conversation
| }}" | ||
| [control]="form.controls['contactInfo']" | ||
| [disabled]="!!selectedMethodToDelete" | ||
| (keydown.enter)="onEnterPress($event, 'sendCode')" |
There was a problem hiding this comment.
In general we should avoid mapping a literal keydown.enter event to these inputs. While the ticket specifically calls out hitting the enter key, we should be using more generalized solutions. Specifically: using a form submit event instead. Mobile keyboards often have some kind of submit functionality built into them and they usually work by submitting the form itself rather than actually triggering an enter key press. So this solution might not work as smoothly on mobile devices.
Right now we have two different inputs with different purposes under one form, which is causing the existing bug. But I think semantically it makes sense for these inputs to be in two separate forms since they have completely different purposes and actions upon submitting. This lets us hit enter/submit/etc on each input and have them do separate things.
|
@meisekimiu replaced the form with 2 forms. Do you think there should be tests for that? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #530 +/- ##
=======================================
Coverage 43.77% 43.78%
=======================================
Files 366 366
Lines 11215 11215
Branches 1841 1841
=======================================
+ Hits 4909 4910 +1
- Misses 6140 6142 +2
+ Partials 166 163 -3 ☔ View full report in Codecov by Sentry. |
meisekimiu
left a comment
There was a problem hiding this comment.
This is fine! There are already existing tests that run sendCode and submitData so we don't really need to test them through the UI.
yeslikesolo
left a comment
There was a problem hiding this comment.
Everything looks great! :D
Add new method to submit 2fa code when user hits enter
f1f45fe to
052413f
Compare
Add new method to submit 2fa code when user hits
Steps to test:
Generate a 2fa code via email or sms
Add it in the input field and then press eneter
It should add/remove the method