primefaces / primeng

The Most Complete Angular UI Component Library
https://primeng.org
Other
10.56k stars 4.61k forks source link

[Android] inputotp does not jump to next field when using onscreen keyboard #16290

Open DwayneHawkins opened 2 months ago

DwayneHawkins commented 2 months ago

Describe the bug

On an android device, in the chrome browser (reproduced with v128.0.6613.88, android 14), surf to https://primeng.org/inputotp In the "Basic" demo, click/tap in the first box Enter "ABC" with your onscreen keyboard The input is all in the same field and it does not go to the next field. Schermafbeelding 2024-08-26 150700

Environment

android 14 chrome browser v127.0.6533.103

Reproducer

No response

Angular version

17.3.5

PrimeNG version

17.17.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

latest

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

The cursor should jump to the next input field in the opt-input-component.

ibrahimkelly commented 2 months ago

Resolved in the latest release. Make npm i primeng@latest or update prime ng version in package.json so npm i.

From chrome

From Edge

DwayneHawkins commented 2 months ago

Thanks, will try!

SoyDiego commented 2 months ago

If it's solved, closed the issue @EdwinHauspie. Thanks! :)

DwayneHawkins commented 2 months ago

I don't think it's fixed, the demo page ( https://primeng.org/inputotp ) on the test device was set to 17.18.9, but the case is very specific. It's a samsung device, with the default samsung keyboard, with text prediction enabled (which is the default). If I go to the keyboard settings and disable the text prediction, the inputopt works OK.

image
DwayneHawkins commented 2 months ago

Fyi I have tested this scenario on a real device as well, confirming the issue. Not sure if this is even solvable :-)

JonathanRangelB commented 2 months ago

Hi, here to confirm what @EdwinHauspie reports, the problem happens on actual android devices using any chromium based browser (tested on edge, chrome, brave, opera mini, firefox, samsung "Internet").

I tested this behavior on different android devices with same strange result, Firefox mobile works as expected though, do not have any IOS device to test and confirm if it has the same problem. Have to mention this is not keyboard related issue (tested on Gboard, samsung keyboard and switkey)

On what I suspect to be the problem is with the usage of event.code, based on MDN event.code is for physical keyboard and event.key for the character the key maps to.

This can be tested using this toptal keycode tool. For example on my linux-brave browser instance the backspace key shows this: Screenshot_20240916_165325

And on the galaxy S22+ android device looks like this:

https://github.com/user-attachments/assets/f19e70fb-96f6-4905-b5d8-ed31eb75ec12

As you might see is that event.code is empty on mobile (see event dump section also), that seems to be the issue in my opinion.

Looking at the sourcecode this might be fixed changing the event.code occurrences with event.key on this line

Hope that helps :smile: