Chrome for Android: Aborting back-swipe changes input handling

Hi!

In Chrome for Android, bringing out the back-navigation arrow and then aborting the back navigation seems to change subsequent input event handling.

Steps to reproduce:

  1. Load any scene with an ArcRotateCamera (like this one). Make sure dragging orbits the target.
  2. Swipe in from right edge to initialize a back-navigation gesture, but abort it by then swiping right.
  3. Now try dragging the scene again to orbit. Instead it seems to zoom in and out.

Here’s a video of the issue: inputBug.mp4 - Google Drive

In our project, this also disables picking objects (using ray-casting), so it seems a bit like all input handlers are reset/deleted. Perhaps this is a Chrome and not a Babylon issue? Thankful for help!

cc @PolygonalSun

Lemme take a look and see what’s going on. I suspect that this issue may be an issue with how we handle focus on Android, with respect to gesture initiation.

1 Like

So here’s what I’ve found. When you first touch the screen, BJS registers it as a touch on the canvas. When the back gesture becomes active, the OS “interrupts” the touch and our code that handles a loss of focus never triggers (because a blur event is never fired). When the back gets aborted, a new touch is registered and all input is treated as though there are two active touches. The fix for this would be listen for pointercancel and handle it that way. I am currently testing this fix and will update when the PR is live.

1 Like

Hi, did you have any luck with the fix? :slightly_smiling_face: Otherwise, there’s a lot of people depending on a solution and we’re thinking of having a go at it ourselves. We’re unfamiliar with the architecture, though, so some kind of rough ETA would be of great help in our decision. :pray: Sorry to bother you!

Hey @antonjolsson, sorry about the delay in responding. For some reason I didn’t get a ping on this. I am working on this, my initial thoughts for the fix ended up not working so I’m trying to work on a different approach. Ideally, I’d like to have something ready and merged sometime early next week.

In the meantime, I’m going to directly assign this to myself so that I don’t miss any other messages.

Fix is in PR: DeviceInputSystem: Add handling for pointercancel events by PolygonalSun · Pull Request #11995 · BabylonJS/Babylon.js (github.com)

1 Like

Hey, no problems. :slight_smile: Thanks for the fix, great work!

1 Like

Fix has been merged

Awesome, thanks again!