Mobile detection on TextInput is broken, please introduce an option/predicate to enable prompting

Yesterday I found out that my Babylon app ran almost* perfectly on my tablet without having to make any changes. Just by virtue of using the observables provided by Babylon itself :+1: Portability to mobile is one of Babylon’s major strengths I think. Thank you for that.

  • Unfortunately I wouldn’t be posting this to Bug reports if there was an issue where this portability broke down. I was using Chrome on Android (edit: the tablet version, phone version is fine) which does not have “mobile” in its UA string, leading to this check:

failing and not showing the prompt. I was using the tablet without a physical keyboard and that left me with no option to enter text. The issue of course shows up in this PG as well:

https://www.babylonjs-playground.com/#UWS0TS

Of course I know there is no way to enable the virtual keyboard from JavaScript so this kludge is necessary. But checking this through the UA string breaks down in borderline cases such as this. Perhaps the caller should be able to supply a predicate function to decide whether a device is to be considered ‘mobile’ in this sense or not. Also, I think the default heuristic could be smarter, for example have the strings ‘iPad’, ‘iPhone’ or ‘Android’ also trigger the mobile behavior.

When I have the time I can do a PR for that. The change is simple enough. Just want to confirm whether there is a reason you are doing it this way. And are there any other places in the source code where prompts need to be displayed, or just this one?

Actually just set this to true if you detect condition that will prevent the use of the prompt

Yep, thanks, I saw that. My prob is exactly the opposite though! The prompt is supposed to show up but doesn’t.

hahaha! Maybe we can add a boolean to force it?

1 Like

Yeah a boolean would be fine too. I have an onFocusObservable anyway so I’m doing my workaround through that. It’s just a bit surprising for simple cases.

Fancy doing a PR?

Yep. It’s on my to-do list :slight_smile:

Hello !
I know this is an old topic, but I am currently having the same issue with a Huawei Mediapad M6 (if the model matter, but I doubt it).

Is the issue fixed? Is there something I can do to fix it?

Thx a lot :slight_smile:

I think it was :slight_smile:

I still have the problem, but I need to investigate further, maybe it’s due to my configuration.
Thx nevertheless :slight_smile:

1 Like