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

[Feature Request] v-otp-input: iOS/Android autofill #14801

Closed
RadarCZ opened this issue Mar 8, 2022 · 6 comments
Closed

[Feature Request] v-otp-input: iOS/Android autofill #14801

RadarCZ opened this issue Mar 8, 2022 · 6 comments
Assignees
Labels
C: VOtpInput VOtpInput T: bug Functionality that does not work as intended/expected
Milestone

Comments

@RadarCZ
Copy link

RadarCZ commented Mar 8, 2022

Problem to solve

Quality-of-life improvement of using this component on pages in mobile browsers. When there is some kind of one-time-passcode verification over SMS, iPhone and Android have some kind of functionality to paste code from the SMS.

Proposed solution

Usually this is done with html input attribute autocomplete="one-time-code"

@KaelWD
Copy link
Member

KaelWD commented Mar 8, 2022

https://web.dev/web-otp/
https://web-otp.glitch.me/
https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/get
https://developer.mozilla.org/en-US/docs/Web/API/OTPCredential

Can you tell me what events are triggered on iOS when a value is entered with this enabled? (just on a <input> is fine)

@KaelWD KaelWD added T: feature A new feature and removed S: triage labels Mar 8, 2022
@RadarCZ
Copy link
Author

RadarCZ commented Mar 8, 2022

Thanks for the links, found out we probably send the SMS in wrong format - will fix that and let you know.
As for the iOS events: I'm currently unable to connect debugger to the iOS device because I don't have a MacOS or Windows device on hand and cannot manage inspect.dev, ios_webkit_debug_proxy or remotedebug-ios-webkit-adapter to work on my linux laptop, which is also in the progress of solving.

I'll keep this issue updated when I manage to achieve progress in any of the points given.

@RadarCZ
Copy link
Author

RadarCZ commented Mar 8, 2022

Update for the SMS format: it kinda worked - iOS asked to fill the input with the code from the message, but when doing so, the second "segment" input is focused instead of the VOtpInput emitting finished event.

@KaelWD
Copy link
Member

KaelWD commented Mar 8, 2022

iOS asked to fill the input with the code from the message

When you do this with a plain <input> element, does it fire a paste event, change, or just input?

@RadarCZ
Copy link
Author

RadarCZ commented Mar 22, 2022

With basic <input> the event is just input, change is triggered on input blur (with the blur event right after it) and paste doesn't fire in this scenario.

@RadarCZ
Copy link
Author

RadarCZ commented Apr 27, 2022

In Safari 15.4 (iOS 15.4) v-otp-input with autocomplete="one-time-code" works as expected - when the message with the code is received, keyboard suggests filling it, when clicking on the suggestion, it fills all of the segments and emits finish. Before emitting finish the input event is triggered 6 times (length attribute of the <v-otp-input>), each time with more of the numbers from the received code.

So when the code is 123456 it emits following events (iOS Safari)

  1. input with parameter 1
  2. input with parameter 12
  3. input with parameter 123
  4. input with parameter 1234
  5. input with parameter 12345
  6. input with parameter 123456
  7. finish

While Android Chrome and iOS Chrome/Firefox (which we tested) are only emitting the first input with just the first number from the code.

@KaelWD KaelWD added T: bug Functionality that does not work as intended/expected and removed S: needs more information T: feature A new feature labels Jun 6, 2022
@KaelWD KaelWD self-assigned this Jun 6, 2022
@KaelWD KaelWD added this to the v2.6.x milestone Jun 6, 2022
@KaelWD KaelWD closed this as completed in 8c67ed8 Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VOtpInput VOtpInput T: bug Functionality that does not work as intended/expected
Projects
None yet
Development

No branches or pull requests

2 participants