From adee13d98c09c5bddc0da41cd38c429498880a09 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 8 Jan 2025 09:49:04 +0000 Subject: [PATCH] fix: account for min-width/height in `slide` transition (#14942) --- .changeset/gold-olives-care.md | 5 +++++ packages/svelte/src/transition/index.js | 3 ++- .../samples/class-shortcut-with-transition/_config.js | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/gold-olives-care.md diff --git a/.changeset/gold-olives-care.md b/.changeset/gold-olives-care.md new file mode 100644 index 0000000000..9f7357c6da --- /dev/null +++ b/.changeset/gold-olives-care.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +fix: account for min-width/height in `slide` transition diff --git a/packages/svelte/src/transition/index.js b/packages/svelte/src/transition/index.js index 4123106211..aacc6b6cf3 100644 --- a/packages/svelte/src/transition/index.js +++ b/packages/svelte/src/transition/index.js @@ -131,7 +131,8 @@ export function slide(node, { delay = 0, duration = 400, easing = cubic_out, axi `margin-${secondary_properties[0]}: ${t * margin_start_value}px;` + `margin-${secondary_properties[1]}: ${t * margin_end_value}px;` + `border-${secondary_properties[0]}-width: ${t * border_width_start_value}px;` + - `border-${secondary_properties[1]}-width: ${t * border_width_end_value}px;` + `border-${secondary_properties[1]}-width: ${t * border_width_end_value}px;` + + `min-${primary_property}: 0` }; } diff --git a/packages/svelte/tests/runtime-legacy/samples/class-shortcut-with-transition/_config.js b/packages/svelte/tests/runtime-legacy/samples/class-shortcut-with-transition/_config.js index 6e3f7a3cb7..e58e8c53c5 100644 --- a/packages/svelte/tests/runtime-legacy/samples/class-shortcut-with-transition/_config.js +++ b/packages/svelte/tests/runtime-legacy/samples/class-shortcut-with-transition/_config.js @@ -18,7 +18,7 @@ export default test({ raf.tick(150); assert.htmlEqual( target.innerHTML, - '

foo

bar

' + '

foo

bar

' ); component.open = true; raf.tick(250);