yglodt
yglodt

Reputation: 14551

JavaScript error using paper-dropdown-menu

As of adding a paper-dropdown-menu to my Polymer web application I run into the following:

When clicking on the dropdown:

Uncaught TypeError
Polymer.Gestures.findOriginalTarget is not a function

after confirming, followed by:

Cannot set property 'right' of undefined

After confirming again the dropdown shows, albeit a bit out of shape.

What's the problem here ?

Upvotes: 0

Views: 186

Answers (1)

Xanzzu
Xanzzu

Reputation: 44

The findOriginalTarget does not seem to be set in your version of polymer. Polymer will probably be updated to support it. In the mean time, however, you can download new version of gestures that will add and replace this types of functions.

Alternatively, you can find _onTap line at paper-dropdown-menu/paper-dropdown-menu.html and replace function with:

  _onTap: function(event) {
    //if (Polymer.Gestures.findOriginalTarget(event) === this) {
    //  this.open();
    //}
    var targetElement = Polymer.dom(event).localTarget;
    if(targetElement === this){
      this.open();
    }
  },

This does work, but I did not test it with touch devices so I can't guarantee that (and I would appreciate feedback on this).

And lastly, if you don't care about _onTap event you could just set it to return false.

Upvotes: 2

Related Questions