PolymerElements / iron-a11y-keys

A basic element implementation of iron-a11y-keys-behavior
19 stars 22 forks source link

Event on-keys-pressed fired twice on Firefox #41

Closed rmdwirizki closed 6 years ago

rmdwirizki commented 7 years ago

Description

The on-keys-pressed event handler fired twice on firefox. But worked fine in Chrome. I have this code :

<dom-module id="my-app">
    <template>
        <iron-a11y-keys target="[[target]]" keys="space" on-keys-pressed="spacing"></iron-a11y-keys>
        <input type="text" autofocus="autofocus">
    </template>
</dom-module>
<script>
...
static get properties() {
    target: Object
}
ready() {
    super.ready()
    this.target = this.shadowRoot.querySelector('input')
}
//This is the event handler
spacing(e) {
    alert('You pressed the ' + e.detail.key + ' key')
}
...
</script>

Expected outcome

When pressing the 'space' key on input element, the alert dialog showed up once

Actual outcome

When pressing the 'space' key on input element, the alert dialog showed up twice instead

Live Demo

https://jsbin.com/jelayoq/2/edit?html,output

Steps to reproduce

  1. Use webcomponents-lite.js > v1.0.0-rc.6. (It starting to fired twice on version above the v1.0.0-rc.6)
  2. Import iron-a11y-keys and use it to bind to input.
  3. Attach an event handler with on-keys-pressed to the input.
  4. Try it on firefox.
  5. Or just open the live demo in firefox browser.

Browsers Affected

I'm using firefox 55.02

mgibas commented 6 years ago

Same for IE11

valdrinkoshi commented 6 years ago

This is a bug on shadydom with removing an event listener on shadow roots, filed an issue here https://github.com/webcomponents/shadydom/issues/190 Closing this in favor of https://github.com/webcomponents/shadydom/issues/190