diff --git a/resources/ext.popups.animation.less b/resources/ext.popups.animation.less index 8599d6902..171d20179 100644 --- a/resources/ext.popups.animation.less +++ b/resources/ext.popups.animation.less @@ -11,6 +11,13 @@ -moz-animation: @arguments; -o-animation: @arguments; animation: @arguments; + + /* Leave the element in its final animation state */ + -webkit-animation-fill-mode: forwards; /* Chrome 16+, Safari 4+ */ + -moz-animation-fill-mode: forwards; /* FF 5+ */ + -o-animation-fill-mode: forwards; /* not implemented yet */ + -ms-animation-fill-mode: forwards; /* IE 10+ */ + animation-fill-mode: forwards; /* when the spec is finished */ } @-webkit-keyframes mwe-popups-fade-in { diff --git a/resources/ext.popups.core.js b/resources/ext.popups.core.js index 63e2d3d7c..0ed695b23 100644 --- a/resources/ext.popups.core.js +++ b/resources/ext.popups.core.js @@ -350,16 +350,16 @@ $box .removeClass( 'mwe-popups-fade-out mwe-popups-fade-in' ) - .addClass( 'mwe-popups-fade-out' ) - .on( 'webkitAnimationEnd oanimationend msAnimationEnd animationend', function () { - if ( $( this ).hasClass( 'mwe-popups-fade-out' ) ) { - $( this ) - .off( 'webkitAnimationEnd oanimationend msAnimationEnd animationend' ) - .removeClass( 'mwe-popups-fade-out' ) - .attr( 'aria-hidden', 'true' ) - .hide(); - } - } ); + .addClass( 'mwe-popups-fade-out' ); // Removed and added to trigger animation + + setTimeout( function () { + if ( $box.hasClass( 'mwe-popups-fade-out' ) ) { + $box + .attr( 'aria-hidden', 'true' ) + .hide() + .removeClass( 'mwe-popups-fade-out' ); + } + }, 150 ); // Matches 0.15s in the .mwe-popups-fade-out class if ( closeTimer ) { clearTimeout( closeTimer );