Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make transitions local by default #8632

Merged
merged 2 commits into from
May 26, 2023
Merged

Conversation

dummdidumm
Copy link
Member

@dummdidumm dummdidumm commented May 25, 2023

BREAKING CHANGE: transitions are now local by default

This means that transitions are not played when they are nested within control flow blocks and a parent control flow block, not its immediate block, makes the element go away.

{#if x}
	{#if y}
		<!-- Svelte 3: <p transition:fade|local> -->
		<p transition:fade>
			fades in and out only when y changes
		</p>

		<!-- Svelte 3: <p transition:fade> -->
		<p transition:fade|global>
			fades in and out when x or y change
		</p>

	{/if}
{/if}

This solves a common gotcha with transitions interfering with page navigations.

To make them global, add the |global modifier:

-<div transition:fade>foo</div>
+<div transition:fade|global>foo</div>

closes #6686

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with npm test and lint the project with npm run lint

To make them global, add the |global modifier
This is a breaking change
closes #6686
@dummdidumm dummdidumm added this to the 4.x milestone May 25, 2023
@vercel
Copy link

vercel bot commented May 25, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
svelte-dev-2 ❌ Failed (Inspect) May 25, 2023 9:15am

Copy link
Member

@Rich-Harris Rich-Harris left a comment

Choose a reason for hiding this comment

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

we'll need to remember to update learn.svelte.dev when this is released

@dummdidumm
Copy link
Member Author

Yes, we also need to update the current tutorial - I haven't got a good idea what to add there and how to make it so that people on version 3 still get the idea, but that's something for another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants