Skip to content

fix: swallow canceled Animation.finished rejections in use_animated_open - #291

Open
ziimakc wants to merge 1 commit into
DioxusLabs:mainfrom
ziimakc:fix/use-animated-open-unhandled-abort
Open

fix: swallow canceled Animation.finished rejections in use_animated_open#291
ziimakc wants to merge 1 commit into
DioxusLabs:mainfrom
ziimakc:fix/use-animated-open-unhandled-abort

Conversation

@ziimakc

@ziimakc ziimakc commented Jul 28, 2026

Copy link
Copy Markdown

Summary

  • use_animated_open waits for in-flight animations/transitions on the closing element to finish via Promise.all(element.getAnimations().map(a => a.finished)).then(...).
  • If any of those animations is canceled rather than finishing naturally (e.g. the element is removed from the DOM before the transition completes), its .finished promise rejects with a DOMException (AbortError: The user aborted a request.).
  • Since the Promise.all(...) chain has no .catch(), this becomes an unhandled promise rejection, logged in the browser console as Uncaught (in promise) AbortError: The user aborted a request.
  • This reproduces with any consumer component (e.g. DropdownMenu) whose content has a plain CSS transition (not even a keyframe animation — CSS Transitions are also returned by Element.getAnimations()), when the item's on_select handler triggers a DOM change (e.g. navigation) that removes the element while its close transition is still running.

Fix

Swallow the per-animation rejection with .catch(() => {}) before Promise.all so a canceled animation resolves like a finished one instead of rejecting the aggregate promise.

Reported in #290, with a CDP-verified repro pinpointing the exact animation.finished access as the throw site.

Test plan

  • cargo fmt --check -p dioxus-primitives
  • Verified in a downstream app (Dioxus 0.7 fullstack) via Playwright + Chrome DevTools Protocol (Runtime.exceptionThrown) that the previously-reproducing "avatar dropdown → navigate" flow no longer throws after this change (built against this commit locally).

Devin Review

Status Commit
⚪ Not started

Run Devin Review

💡 Connect your GitHub account to enable automatic code reviews.

Open in Devin Review (Staging)

When the element bound to use_animated_open is removed from the DOM (or
its animation/transition is otherwise canceled) before finishing
naturally, each canceled animation's `finished` promise rejects with a
DOMException (AbortError), which surfaces as an unhandled promise
rejection since Promise.all(...).then(...) has no catch handler.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant