Skip to content

fix: make onintrostart respect delay parameter#17567

Merged
Rich-Harris merged 7 commits into
sveltejs:mainfrom
Eruis2579:fix/introstart-delay
Jan 28, 2026
Merged

fix: make onintrostart respect delay parameter#17567
Rich-Harris merged 7 commits into
sveltejs:mainfrom
Eruis2579:fix/introstart-delay

Conversation

@Eruis2579

Copy link
Copy Markdown

Fixes #14009

The onintrostart event now fires after the delay period completes, rather than immediately when the transition is initiated. This ensures that the event accurately reflects when the intro animation actually starts.

Changes

  • Added on_start callback parameter to animate() function
  • Dispatch introstart event after delay animation finishes (in animation.onfinish)
  • Handle edge case where duration is 0 but delay > 0

Testing

This fix ensures that when a transition has a delay:

  • The onintrostart event fires after the delay completes
  • The event timing matches when the animation actually starts
  • Works correctly even when duration is 0 but delay > 0

Fixes sveltejs#14009

The onintrostart event now fires after the delay period completes,
rather than immediately when the transition is initiated. This ensures
that the event accurately reflects when the intro animation actually
starts.

Changes:
- Added on_start callback parameter to animate() function
- Dispatch introstart event after delay animation finishes
- Handle edge case where duration is 0 but delay > 0
@changeset-bot

changeset-bot Bot commented Jan 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2472adc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

Playground

pnpm add https://pkg.pr.new/svelte@17567

@Rich-Harris Rich-Harris left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@Rich-Harris Rich-Harris merged commit 16fec72 into sveltejs:main Jan 28, 2026
14 checks passed
@github-actions github-actions Bot mentioned this pull request Jan 28, 2026
Rich-Harris pushed a commit that referenced this pull request Apr 20, 2026
closes #18056
related: #17567 and #14009

# Changes

move `dispatch_event()` calls in `transitions.js` out of `animate()`
function using an additional `on_begin()` callback parameter. Doing so
makes it possible to dispatch the `introstart` and `outrostart` events
only from `transition()`.

# Testing

add a test checking that svelte dispatches no event when it runs an
animation
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.

onintrostart does not respect delay

2 participants