Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Observer set for value attribute gets fired twice each time an item gets picked #252

Open
vedtam opened this issue Jun 25, 2017 · 1 comment

Comments

@vedtam
Copy link

vedtam commented Jun 25, 2017

Hi,

Each time I pick an item from the paper-dropdown-menu, the observer which I set for the value attribute gets fired twice, once having the desired value and a second time having null.

Expected outcome

The observer should fire only once / item picked.

Thanks!

screen shot 2017-06-25 at 08 59 29

<paper-dropdown-menu label="pick a category" value="{{category}}" id="categories" style="display: inline;">
  <paper-listbox slot="dropdown-content" class="dropdown-content" selected="{{selectedCategory}}">
    <template is="dom-repeat" items="{{noneEmptyCategs}}">
        <paper-item value={{item.category}}>{{item.category}}</paper-item>
    </template>
  </paper-listbox>
</paper-dropdown-menu>

....

static get properties(){
  return {
    category: {
      type: String,
      observer: 'categorySelected',
      value: ''
    }
  }
}


categorySelected(category){
  console.log('item picked: ' + category);
}
@hobbyquaker
Copy link

hobbyquaker commented Aug 7, 2017

https://github.com/PolymerElements/paper-dropdown-menu/blob/master/paper-dropdown-menu.html#L354 - I'm asking myself if handling the iron-deselect event is neccessary at all because one can't deselect something in a dropdown?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants