Skip to content

DOMUtils.waitForAnimation has no timeout — can hang forever #67

@thedhanawada

Description

@thedhanawada

Bug Description

`DOMUtils.waitForAnimation()` (lines 133-141 in `src/utils/DOMUtils.js`) returns a Promise that resolves when an animation/transition ends, but has no timeout:

```js
static waitForAnimation(element, eventType = 'animationend') {
return new Promise(resolve => {
const handler = () => {
element.removeEventListener(eventType, handler);
resolve();
};
element.addEventListener(eventType, handler);
});
}
```

If the animation is cancelled, the element is removed from DOM, or no animation actually fires, the Promise never resolves. Any `await` on this call will hang indefinitely.

Impact

  • Calling code that `await`s this method can freeze if the animation doesn't fire
  • No way for callers to recover from a hung animation wait
  • Memory leak: the event listener is never removed if the event never fires

Expected Fix

Add a timeout with a fallback:
```js
static waitForAnimation(element, eventType = 'animationend', timeout = 5000) {
return new Promise(resolve => {
const handler = () => {
element.removeEventListener(eventType, handler);
clearTimeout(timer);
resolve();
};
element.addEventListener(eventType, handler);
const timer = setTimeout(handler, timeout);
});
}
```

Files

  • `src/utils/DOMUtils.js:133-141`

Metadata

Metadata

Assignees

No one assigned

    Labels

    phase:0-foundationImmediate fixes and test infrastructurepriority:highImportant for next milestonetype:bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions