Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Commit

Permalink
fire neon-animation-finish before display: none
Browse files Browse the repository at this point in the history
  • Loading branch information
valdrinkoshi committed Mar 27, 2018
1 parent 3a54fb8 commit 6c39cba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 deletions.
2 changes: 1 addition & 1 deletion paper-dialog.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* </paper-dialog>
*
* ### Changes in 2.0
* - `paper-dialog-behavior 2.0` styles only direct `h2` and `.buttons` children of the dialog because of how [`::slotted` works](https://developers.google.com/web/fundamentals/primers/shadowdom/?hl=en#stylinglightdom)
* - `paper-dialog-behavior 2.0` styles only direct `h2` and `.buttons` children of the dialog because of how [`::slotted` works](https://developers.google.com/web/fundamentals/primers/shadowdom/?hl=en#stylinglightdom)
* (compound selector will select only top level nodes)
* - `<paper-dialog>` uses CSS animation keyframes instead of `neon-animation`, ([see Animations section](#Animations))
*
Expand Down
32 changes: 12 additions & 20 deletions paper-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ <h2>Header</h2>
</paper-dialog>
### Changes in 2.0
- `paper-dialog-behavior 2.0` styles only direct `h2` and `.buttons` children of the dialog because of how [`::slotted` works](https://developers.google.com/web/fundamentals/primers/shadowdom/?hl=en#stylinglightdom)
- `paper-dialog-behavior 2.0` styles only direct `h2` and `.buttons` children of the dialog because of how [`::slotted` works](https://developers.google.com/web/fundamentals/primers/shadowdom/?hl=en#stylinglightdom)
(compound selector will select only top level nodes)
- `<paper-dialog>` uses CSS animation keyframes instead of `neon-animation`, ([see Animations section](#Animations))
Expand Down Expand Up @@ -153,20 +153,20 @@ <h2>Header</h2>
],

listeners: {
'animationend': '_onAnimationEnd'
'animationend': '_onAnimationend'
},

properties: {
/**
* The class defining the entry animation. `<paper-dialog>` ships
* The class defining the entry animation. `<paper-dialog>` ships
* `fade-in-animation, fade-out-animation, scale-up-animation, scale-down-animation`,
* but you can use custom animations too. See the Animations section in the README.md.
*/
entryAnimation: {
type: String
},
/**
* The class defining the exit animation. `<paper-dialog>` ships
* The class defining the exit animation. `<paper-dialog>` ships
* `fade-in-animation, fade-out-animation, scale-up-animation, scale-down-animation`,
* but you can use custom animations too. See the Animations section in the README.md.
*/
Expand Down Expand Up @@ -205,11 +205,10 @@ <h2>Header</h2>
this.classList.add(animation);
if (this._willAnimate() === false) {
console.info(animation + ' animation was not played');
this.classList.remove(animation);
this._onAnimationFinish();
this._onAnimationend();
}
} else {
this._onAnimationFinish();
this._onAnimationend();
}
},

Expand All @@ -224,30 +223,23 @@ <h2>Header</h2>
},

/**
* @param {!Event} event
* @param {Event=} event
* @private
*/
_onAnimationEnd: function(event) {
if (event.target !== this) {
_onAnimationend: function(event) {
if (event && event.target !== this) {
return;
}
// Fire for backwards compat.
this.fire('neon-animation-finish');
if (!this.opened) {
// Ensure to update display before removing the
// Ensure to update display before removing the
// animation class, so that user doesn't see flickering
// e.g. dialog returning to its initial position/opacity.
this.style.display = 'none';
}
// Removes the classes.
this.cancelAnimation();
// Fire for backwards compat.
this.fire('neon-animation-finish');
this._onAnimationFinish();
},

/**
* @private
*/
_onAnimationFinish: function() {
if (this.opened) {
this._finishRenderOpened();
} else {
Expand Down

0 comments on commit 6c39cba

Please sign in to comment.