Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paper-listbox selected-item-changed is fired twice #5159

Closed
yasar11732 opened this issue Mar 21, 2018 · 2 comments
Closed

paper-listbox selected-item-changed is fired twice #5159

yasar11732 opened this issue Mar 21, 2018 · 2 comments

Comments

@yasar11732
Copy link

This is my package.json

{
  "name": "test-case",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "dependencies": {
    "@polymer/paper-item": "^3.0.0-pre.11",
    "@polymer/paper-listbox": "^3.0.0-pre.11",
    "@polymer/paper-menu-button": "^3.0.0-pre.11",
    "@webcomponents/webcomponentsjs": "^1.1.0",
    "web-animations-js": "^2.3.1"
  }
}

This is my example test case

<!doctype html>
<html>
  <head>
    <script src="./node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
    <script src="./node_modules/web-animations-js/web-animations-next-lite.min.js"></script>
    <script type="module" src="./node_modules/@polymer/paper-menu-button/paper-menu-button.js"></script>
    <script type="module" src="./node_modules/@polymer/paper-listbox/paper-listbox.js"></script>
    <script type="module" src="./node_modules/@polymer/paper-item/paper-item.js"></script>
    <script>
        document.addEventListener("DOMContentLoaded", function() {
            counter = 0;
            mylistbox.addEventListener("selected-item-changed", function(){
                counter++;
                console.log(counter + " " + mylistbox.selected);
            })
        });
    </script>
  </head>
  <body>


        <paper-menu-button noAnimations="true">
        <a slot="dropdown-trigger" alt="menu">Click Here For Menu</a>
        <paper-listbox slot="dropdown-content"  attr-for-selected="name" id="mylistbox" selected="alpha">
            <paper-item name="alpha">alpha</paper-item>
            <paper-item name="beta">beta</paper-item>
            <paper-item name="gamma">gamma</paper-item>
            <paper-item name="delta">delta</paper-item>
            <paper-item name="epsilon">epsilon</paper-item>
        </paper-listbox>
        </paper-menu-button>
  </body>
</html>

Select an item from the listbox and "selected-item-changed" will be fired two times, while it should be fired once.

@TimvdLippe
Copy link
Contributor

Runnable JSBin: http://jsbin.com/gozixulagi/edit?html,console,output Seems to be an issue in iron-selector.

@TimvdLippe
Copy link
Contributor

This issue was moved to PolymerElements/iron-selector#170

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

No branches or pull requests

2 participants