mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-28 01:20:07 +00:00
Ensure page load popupNotification is closed when the toggle button is clicked
Bug: T335153 Change-Id: Iafe0f08554d8844acb60ef9fdd1fce4594459aac
This commit is contained in:
parent
b1688baeb5
commit
fef0ced503
|
@ -133,14 +133,18 @@ function addLimitedWidthPopup( container, message, onDismiss = () => {} ) {
|
|||
`;
|
||||
const popupFrag = document.createRange().createContextualFragment( popupTemplateString );
|
||||
container.appendChild( popupFrag );
|
||||
const closeButton = /** @type {HTMLElement} */ ( document.querySelector( '.vector-limited-width-popup-close-button' ) );
|
||||
closeButton.addEventListener( 'click', () => {
|
||||
|
||||
const closePopup = () => {
|
||||
const popup = /** @type {HTMLElement} */ ( document.querySelector( '.vector-limited-width-popup' ) );
|
||||
if ( popup && popup.parentElement ) {
|
||||
popup.parentElement.removeChild( popup );
|
||||
}
|
||||
onDismiss();
|
||||
}, { once: true } );
|
||||
};
|
||||
const closeButton = /** @type {HTMLElement} */ ( document.querySelector( '.vector-limited-width-popup-close-button' ) );
|
||||
closeButton.addEventListener( 'click', closePopup, { once: true } );
|
||||
const toggle = /** @type {HTMLElement} */ ( document.querySelector( '.vector-limited-width-toggle' ) );
|
||||
toggle.addEventListener( 'click', closePopup, { once: true } );
|
||||
}
|
||||
|
||||
module.exports = init;
|
||||
|
|
Loading…
Reference in a new issue