googlearchive / paper-tabs

A tabs à la Material Design
22 stars 21 forks source link

`core-select` event firing twice #6

Closed robdodson closed 10 years ago

robdodson commented 10 years ago

I think this is probably a deeper problem with core-selector, but it manifests in paper-tabs. Related to https://github.com/Polymer/polymer-tutorial/issues/7, if you listen for core-select you'll get two events when a user taps. Here's a jsbin to reproduce: http://jsbin.com/tebiwu/1/edit

frankiefu commented 10 years ago

This is expected. core-selector's core-select event is fired when an item's selection state is changed. This event is fired both when an item is selected or deselected. So that's why you see 2 events for a single tap, one for selected and one for deselected.

You can use isSelected from the event.detail to check the selection state. http://jsbin.com/vicaseka/1/edit