-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Open
Description
Describe the bug
I'm encountering an issue with the flip animation on a list of elements in Svelte. The list is dynamically updated based on WebSocket messages. Here's what happens:
- The flip animation works fine when the tab is active.
- When I switch to another tab or minimize the browser, and wait for some time, the flip animation either stops or behaves unexpectedly.
- After returning to the tab, I notice that certain elements have incorrect computed styles, such as:
transform: matrix(1, 0, 0, 1, 0, 1394). These elements are not positioned correctly. - If I trigger a sort function on the list after returning to the tab, the issue resolves, and everything falls back into place.
I suspect the issue might be related to requestAnimationFrame being paused when the tab is inactive, which might interfere with how the flip animation is applied.
Reproduction
Steps to Reproduce:
- Switch to another tab or minimize the browser (Safari or Firefox) and wait for some time.
- Dynamically update the list via WebSocket messages.
- Return to the tab and observe the animation behavior and computed transform style.
Expected Behavior:
- The flip animation should continue running smoothly when returning to the tab.
- The elements should not have incorrect transform values or be positioned incorrectly.
Actual Behavior:
- The flip animation stops or behaves unexpectedly when returning to the tab.
- Some elements have incorrect computed styles like
transform: matrix(1, 0, 0, 1, 0, 1394, which positions them incorrectly. - Triggering a sort while the tab is active again fixes the issue.
Additional Information:
It seems that requestAnimationFrame might be paused while the tab is inactive, causing this issue. Sorting the list while the tab is active again fixes the problem, but this is not an ideal workaround.
Currently, I'm working around this issue by disabling the flip animation when the tab becomes inactive and re-enabling it when the tab becomes active again. However, this is more of a temporary fix.
Logs
No response
System Info
System:
OS: macOS 14.6.1
CPU: (10) arm64 Apple M1 Pro
Memory: 103.28 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v20.8.0/bin/yarn
npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
Browsers:
Safari: 17.6
npmPackages:
svelte: ^5.0.0-next.238 => 5.0.0-next.263Severity
annoyance
Metadata
Metadata
Assignees
Labels
No labels