HTML mouse event translation

Somewhat new to Capacitor. I have an Angular application with a component that has an HTML button with mousedown and mouseup event handlers.

In the web version of the app on a browser those events function as expected. However, when running as a Capacitor Android app it does not behave as I would expect.

Maybe the Android touch/input events do not exactly correlate to the web event types. So for Android there are:

  • Click
  • LongClick
  • Touch

Does anyone know how the web mouse event types might map to Android touch events? Is there a concept of a mousedown when translated to Android. It seems as if the mouseup fires on a regular touch but a press and hold (i.e. mousedown) does not seem to register.

The solution for me was to listen to multiple web events for the button that are pertinent to each platform.

For the “down or press” event:

  • mousedown - web browser / desktop mouse triggered
  • touchstart - triggered in mobile capacitor app

Similarly for the “down or release” event:

  • mouseup
  • touchend