Skip to content
This repository has been archived by the owner on Sep 20, 2019. It is now read-only.

event patching not working on shadowRoot (removeEventListener) #190

Closed
valdrinkoshi opened this issue Oct 26, 2017 · 4 comments
Closed

event patching not working on shadowRoot (removeEventListener) #190

valdrinkoshi opened this issue Oct 26, 2017 · 4 comments
Assignees

Comments

@valdrinkoshi
Copy link
Contributor

valdrinkoshi commented Oct 26, 2017

event patching is not working properly for element shadowRoots, in particular event listeners aren't removed. e.g. See the following repro on Firefox http://jsbin.com/mizatey/2/edit?html,output

var logger = function(event) { console.log('clicked!', event) };
var el = document.createElement('div');
el.attachShadow({mode: 'open'}).innerHTML = 'click me';
document.body.appendChild(el);
el.shadowRoot.addEventListener('click', logger);
el.shadowRoot.removeEventListener('click', logger);

Try clicking on the element and notice that logger keeps being invoked.

@sorvell
Copy link
Contributor

sorvell commented Feb 9, 2018

@azakus It looks to me like the problem is where we store the listener info . We're always storing this as the target node, but this should be target which is specially set when we're listening on a shadowRoot. We do correctly pass this same specially set target when we try to find the listener in removeEventListener. Does that sound right?

@valdrinkoshi
Copy link
Contributor Author

Verified the fix for the issue originally raised in predixdesignsystem/px-data-grid#331 and it does fix it 👌

@talimarcus
Copy link

talimarcus commented Mar 5, 2018

Any update/ETA on this?

@sorvell sorvell closed this as completed in fc09529 Mar 6, 2018
sorvell pushed a commit that referenced this issue Mar 6, 2018
@talimarcus
Copy link

Sweet, checked the fix with PolymerElements/iron-a11y-keys#44 and it worked 👍 Can we get a tag for this please?

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

4 participants