paper-dropdown-menu icon indicating copy to clipboard operation
paper-dropdown-menu copied to clipboard

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

Open vedtam opened this issue 7 years ago • 1 comments

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);
}

vedtam avatar Jun 25 '17 06:06 vedtam

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?

hobbyquaker avatar Aug 07 '17 17:08 hobbyquaker