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

deregisterBodyClickListener not working - possible fix #6557

Closed
cintaccs opened this issue Oct 28, 2020 · 2 comments · Fixed by #6565
Closed

deregisterBodyClickListener not working - possible fix #6557

cintaccs opened this issue Oct 28, 2020 · 2 comments · Fixed by #6565
Labels

Comments

@cintaccs
Copy link

Screenshot 2020-10-28 at 09 48 59

activating - deactivating the menu's keeps registrering the click event listener on MDCMenuSurface.

Possible fix:
menu-surface component
component.js

MDCMenuSurface.prototype.initialSyncWithDOM
        this.deregisterBodyClickListener = function () {
//BEFORE: document.body.removeEventListener('click', _this.handleBodyClick);
//AFTER: add the , { capture: true } to the removeEventListener 
//to match the document.body.addEventListener('click', _this.handleBodyClick, { capture: true });
            document.body.removeEventListener('click', _this.handleBodyClick, { capture: true });
        };

FYI - this suggestion has been reported on issue on #1920 in repo material-components-web-components too.

@cintaccs cintaccs added the bug label Oct 28, 2020
@dfreedm
Copy link
Contributor

dfreedm commented Oct 29, 2020

This seems like an MWC specific bug, closing in favor of material-components/material-web#1920

@dfreedm dfreedm closed this as completed Oct 29, 2020
@dfreedm dfreedm reopened this Oct 29, 2020
@dfreedm
Copy link
Contributor

dfreedm commented Oct 29, 2020

Actually, there are separate issues here, one in MWC and one in MDC. Sorry!

copybara-service bot pushed a commit that referenced this issue Oct 30, 2020
…roperly deregistered.

closes: #6557
PiperOrigin-RevId: 339893099
copybara-service bot pushed a commit that referenced this issue Oct 30, 2020
…roperly deregistered.

closes: #6557
PiperOrigin-RevId: 339893099
copybara-service bot pushed a commit that referenced this issue Oct 30, 2020
…roperly deregistered.

closes: #6557
PiperOrigin-RevId: 339893099
copybara-service bot pushed a commit that referenced this issue Oct 30, 2020
…roperly deregistered.

closes: #6557
PiperOrigin-RevId: 339893099
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants