silverdr
I try to implement “show fancy” and “hide fancy” as in examples in the fine docs of Phoenix.LiveView.JS. While I seem to have no problems with hide and it always seem to behave correctly [^1], the show part is problematic. More often than not (but not always) the element first pops-up and only then starts the CSS animation. Now, if I understand correctly, this works by setting display: block and applying the transition class for the duration given in time:. My guess is that there might be a race condition between applying display: block (which causes the element to show prematurely) and applying the transition CSS class, which then starts the animation.
Any existing cures for this type of problem? Or am I doing something wrong?
[^1] - once I added time: 750 - CSS animation is theoretically set to 200ms but in practice the element used to disappear before the animation finished.
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
arcanemachine
I have also noticed this issue in Firefox but not in Chrome.
And the last time I checked, I didn’t see it in Firefox either (which lends credence to your suggestion that it’s a race condition).
silverdr
Thank you for confirming. I noticed it in all (three major) browsers. Very similar in all cases.
Here’s a screen recording
silverdr
FWIW (in case someone might notice an error there) - the trigger is:
And the “fancy” CSS is defined as:
silverdr
A pull-request with quick-fix for the problem:
https://github.com/phoenixframework/phoenix_live_view/pull/3455