• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps How to prevent Android's native webview from performing a mousedown event after a touchdown?

tbop

Lurker
Hi alien's folks!

Hard to believe there's no official developer forum on android.co... thereby I basically ended up down there on this lovely Tuesday morning.
I've got a little dood that may interest some of you guys (hopefully!....)

When registering to mousedown and touchdown events on a webview both are triggered at the very same time, leading up to the odd situation of having twice "mousedown-like" events to deal with. There's a known workaround which consists of calling event.preventDefault()... but I cannot call it because I do need to get the default behavior anyway. And of course I cannot remove the regular mouse events listeners neither without no longer being compatible with a regular computer.

There's another known workaround which consists of detecting whether the first event that we receive is of touchevent type or not, in the former case we then simply remove the listeners to the mouse events.... But I've found it ugly and moreover I can't believe why the Android's native browser keeps firing mouse event whereas touch events are registered and there's no way to prevent that from happening in the manifest or somewhere else.

Btw: this issue doesn't occur on Safari mobile.

Thank you very much!
 
Back
Top Bottom