Describe the bug
The classList copied onto a SpritePosition instance via _getCurrentPosition can get into situations that copy the ember-animated-hide class into the cached classList
|
classList: Array.from(this.element.classList), |
When _reapplyPosition gets called, this can result in ember-animated-hide getting re-applied, hiding sprites that may have been revealed between the _getCurrentPosition and the _reapplyPosition call.
This results in situations where ember-animated-hide remains on the sprite after all is said and done.
To Reproduce
I had a really tough time reproducing this outside of my dev codebase. I tried on twiddle to no avail, I'm worried I was also hampered by the 0.5.4 version of ember-animated in the twiddle.json, I tried to bring it up to 0.10.1 but things didn't seem build.
My situation was an {{#animated-if foo}} ... {{else animated-if bar}} ... {{else}} ... {{/animated-if}}
Where if foo == false and bar == true, the contents of the second block would have its elements hidden on initial render.
It's not clear exactly why reapplyPosition would get called after a reveal was called or perhaps why getCurrentPosition would happen on elements that were already hidden, but this scenario where ember-animated-hidden remained on the element has happened a number of times to me, and I spent some time digging this time.
Expected behaviour
The this._revealed property of a Sprite and the application of the element class ember-animated-hide should always be applied in concert and never drift.
Desktop (please complete the following information):
- OS: Mac OS 10.15.5
- Browser Chrome
- Version 86
Describe the bug
The classList copied onto a SpritePosition instance via
_getCurrentPositioncan get into situations that copy theember-animated-hideclass into the cached classListember-animated/addon/-private/sprite.ts
Line 403 in 51e4b84
When
_reapplyPositiongets called, this can result inember-animated-hidegetting re-applied, hiding sprites that may have been revealed between the_getCurrentPositionand the_reapplyPositioncall.This results in situations where
ember-animated-hideremains on the sprite after all is said and done.To Reproduce
I had a really tough time reproducing this outside of my dev codebase. I tried on twiddle to no avail, I'm worried I was also hampered by the 0.5.4 version of ember-animated in the
twiddle.json, I tried to bring it up to 0.10.1 but things didn't seem build.My situation was an
{{#animated-if foo}} ... {{else animated-if bar}} ... {{else}} ... {{/animated-if}}Where if
foo == falseandbar == true, the contents of the second block would have its elements hidden on initial render.It's not clear exactly why
reapplyPositionwould get called after a reveal was called or perhaps whygetCurrentPositionwould happen on elements that were already hidden, but this scenario whereember-animated-hiddenremained on the element has happened a number of times to me, and I spent some time digging this time.Expected behaviour
The
this._revealedproperty of a Sprite and the application of the element classember-animated-hideshould always be applied in concert and never drift.Desktop (please complete the following information):