Skip to content

Button clicks not triggering on Android devices #406

@piersbertrand

Description

@piersbertrand

I am writing an application using ionic and ui-router, and hit a snag.

On Android devices (at least from 4.4 onwards) there is a problem with the click event polyfill, which means that no buttons trigger events. Ionic triggers a CustomEvent for a tap that does not contain the event.which property that is required by the ui-sref directive. I resolved this by the following snippet:

ionic.EventController = {
...
    trigger: function(eventType, data) {
      var event = new CustomEvent(eventType, { detail: data });
      event.which = 1;

The important part of this is the event.which is used by ui-router (and jquery) to determine that the created click event is a right button click.

I am pretty sure this is a fragile fix, and probably the new event should clone nearly all of the originating events properties.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions