googlearchive / paper-tabs

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

add a custom event called tab-selected when the selected item changes #13

Closed warnerandy closed 10 years ago

warnerandy commented 10 years ago

Using the "core-select" event on paper-tabs yields 2 events (one for the unselected element and one for the newly selected element), which is unexpected. Instead I've added a "tab-selected" event that is fired when the selected item is changed (where the target element is the newly selected tab). This gives me the result I expect, one event with the newly selected tab's element in the event.

warnerandy commented 10 years ago

@addyosmani sorry bout the formatting, my editor is responsible for that one, I'll reset it and make my change in emacs :), and add some docs code in as well.

addyosmani commented 10 years ago

That looks much better, thanks!

frankiefu commented 10 years ago

In general, selection logic should be handled in core-selector/core-selection. If we think is a good idea to have an event just for selected then we should add it in core-selector so other elements extend from core-selector will benefit from it too. FWIW, you can tell from core-select event that it was fired for selected or unselected. If you still think it should have a separate event then I suggest to file an issue on core-selector.

warnerandy commented 10 years ago

Sounds fair, I was confused during the tutorial to log the event for the tabs bar and receive 2 events. I would expect two events from listening to the tab elements but not the tabs element.