-
Notifications
You must be signed in to change notification settings - Fork 113
Fix panel's close button event listener being assigned multiple times #154
Conversation
Hi @leddie24, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! The agreement was validated by Microsoft and real humans are currently evaluating your PR. TTYL, MSBOT; |
if (closeButton !== null) { | ||
closeButton.addEventListener("click", () => { | ||
let closeButtonClone = closeButton.cloneNode(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should just remove the listener if it's there? Does this clone the element several times?
I'm not seeing any errors in the console 👍 Interesting bug... I'm not sure if this was there before, but after opening a panel, the vertical scrollbar disappears preventing me from scrolling up or down the page (to see the other examples, for instance). This was in Chrome. |
Hey @ericthompson, we're using the overlay component in conjunction with Panel. Overlay prevents scrolling and user interaction with the page, so it's intended, unless we want to change how Overlay works. |
Yep, but it's leaving the page in a permanently broken state after dismissing the panel. Playing with it a bit more, it only occurs if you dismiss via the X - not via light dismiss by clicking on the Overlay itself. It seems like the Overlay might be staying on the page? |
Ahh, I see. Didn't notice that, I'll check it out. |
All set, PanelHost wasn't hiding Overlay on dismiss. |
Fix closeButton's event listener from being assigned multiple times. This fixes bug #147. Every time the component is instantiated, the closeButton's click handler is assigned, but never removed. Added a closeButtonClone element in _setEvents and added the event listener to that element instead.