Skip to content

Commit 8c33015

Browse files
committed
more generic
1 parent d36ce0a commit 8c33015

File tree

4 files changed

+21
-11
lines changed

4 files changed

+21
-11
lines changed

documentation/docs/98-reference/.generated/client-warnings.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,14 @@ Reactive `$state(...)` proxies and the values they proxy have different identiti
223223
224224
To resolve this, ensure you're comparing values where both values were created with `$state(...)`, or neither were. Note that `$state.raw(...)` will _not_ create a state proxy.
225225
226-
### transition_slide_display_table
226+
### transition_slide_display
227227
228228
```
229229
The `slide` transition does not work correctly with elements with `display: %value%`
230230
```
231231
232-
The [slide](/docs/svelte/svelte-transition#slide) transition works by animating the `height` of the element. Setting `height` to a value smaller than the element's natural height has no effect if the element's [`display`](https://developer.mozilla.org/en-US/docs/Web/CSS/display) style starts with `table` (which is the default state of table elements such as `<tr>`).
232+
The [slide](/docs/svelte/svelte-transition#slide) transition works by animating the `height` of the element, which requires a `display` style like `block`, `flex` or `grid`. It does not work for:
233233
234-
Consider using a `flex` or `grid` layout instead.
234+
- `display: inline` (which is the default for elements like `<span>`), and its variants like `inline-block`, `inline-flex` and `inline-grid`
235+
- `display: table` and `table-[name]`, which are the defaults for elements like `<table>` and `<tr>`
236+
- `display: contents`

packages/svelte/messages/client-warnings/warnings.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,12 @@ To fix it, either create callback props to communicate changes, or mark `person`
187187
188188
To resolve this, ensure you're comparing values where both values were created with `$state(...)`, or neither were. Note that `$state.raw(...)` will _not_ create a state proxy.
189189
190-
## transition_slide_display_table
190+
## transition_slide_display
191191
192192
> The `slide` transition does not work correctly with elements with `display: %value%`
193193
194-
The [slide](/docs/svelte/svelte-transition#slide) transition works by animating the `height` of the element. Setting `height` to a value smaller than the element's natural height has no effect if the element's [`display`](https://developer.mozilla.org/en-US/docs/Web/CSS/display) style starts with `table` (which is the default state of table elements such as `<tr>`).
194+
The [slide](/docs/svelte/svelte-transition#slide) transition works by animating the `height` of the element, which requires a `display` style like `block`, `flex` or `grid`. It does not work for:
195195
196-
Consider using a `flex` or `grid` layout instead.
196+
- `display: inline` (which is the default for elements like `<span>`), and its variants like `inline-block`, `inline-flex` and `inline-grid`
197+
- `display: table` and `table-[name]`, which are the defaults for elements like `<table>` and `<tr>`
198+
- `display: contents`

packages/svelte/src/internal/client/warnings.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,10 @@ export function state_proxy_equality_mismatch(operator) {
171171
* The `slide` transition does not work correctly with elements with `display: %value%`
172172
* @param {string} value
173173
*/
174-
export function transition_slide_display_table(value) {
174+
export function transition_slide_display(value) {
175175
if (DEV) {
176-
console.warn(`%c[svelte] transition_slide_display_table\n%cThe \`slide\` transition does not work correctly with elements with \`display: ${value}\`\nhttps://svelte.dev/e/transition_slide_display_table`, bold, normal);
176+
console.warn(`%c[svelte] transition_slide_display\n%cThe \`slide\` transition does not work correctly with elements with \`display: ${value}\`\nhttps://svelte.dev/e/transition_slide_display`, bold, normal);
177177
} else {
178-
console.warn(`https://svelte.dev/e/transition_slide_display_table`);
178+
console.warn(`https://svelte.dev/e/transition_slide_display`);
179179
}
180180
}

packages/svelte/src/transition/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,16 @@ var slide_warning = false;
108108
export function slide(node, { delay = 0, duration = 400, easing = cubic_out, axis = 'y' } = {}) {
109109
const style = getComputedStyle(node);
110110

111-
if (DEV && style.display.startsWith('table-') && !slide_warning) {
111+
if (
112+
DEV &&
113+
!slide_warning &&
114+
(style.display.includes('table') ||
115+
style.display.includes('inline') ||
116+
style.display === 'contents')
117+
) {
112118
slide_warning = true;
113119
Promise.resolve().then(() => (slide_warning = false));
114-
w.transition_slide_display_table(style.display);
120+
w.transition_slide_display(style.display);
115121
}
116122

117123
const opacity = +style.opacity;

0 commit comments

Comments
 (0)