---
title: Specify Explicit Duration for Nested Transitions
impact: MEDIUM
impactDescription: Nested transitions with different timings may end prematurely when Vue detects only the root element's transition end
type: gotcha
tags: [vue3, transition, animation, duration, nested, timing]
---
# Specify Explicit Duration for Nested Transitions
**Impact: MEDIUM** - When transitioning elements that contain nested child elements with different animation timings, Vue by default listens only for the first `transitionend` or `animationend` event on the **root** transition element. This means if inner elements have longer or delayed animations, they may be cut off when the root element's transition completes.
## Task Checklist
- [ ] Identify if your transition contains nested elements with different animation durations
- [ ] Use the `:duration` prop to specify the total time Vue should wait
- [ ] Consider using separate enter and leave durations if they differ
- [ ] Test animations to ensure nested elements complete fully
**Problematic Code:**
```vue
Hello
```
**Correct Code:**
```vue
Hello
```
## Different Enter and Leave Durations
```vue
Title
Content with staggered animation
```
## Choreographed Staggered Animations
```vue
Title
Body text...
```
## Calculating Duration
Use this formula to calculate the correct duration:
```
duration = max(delay + animation_duration) for all nested elements
```
Example:
- Element A: no delay, 300ms duration = 300ms total
- Element B: 100ms delay, 300ms duration = 400ms total
- Element C: 200ms delay, 500ms duration = 700ms total
**Required `:duration`**: 700 (or slightly higher for safety margin)
## Reference
- [Vue.js Transition - Nested Transitions](https://vuejs.org/guide/built-ins/transition.html#nested-transitions-and-explicit-transition-durations)