Probably old news now, but the CSS View Transition API is SUPER cool!
@devongovett42 тыс. подписчиков
98 021 просмотр
10 комментариев
Комментарии из оригинального поста в X (Twitter)

@devongovett
Code:
56 отметок «Нравится»

@chinchang457
yes! And here's a demo without the performance hit of using flushSync
4 отметки «Нравится»

@devongovett
flushSync is fine. This is the exact type of thing it is designed for. Actually in this case it may even be faster. When startViewTransition is called it freezes the DOM to take a snapshot. Flushing synchronously reduces the time the page is frozen because updates occur immediately rather than waiting unnecessarily.
8 отметок «Нравится»

@jimmeyer
Super clean. I immediately tried clicking the add button before the current transition had finished, finding that it then ignores that click. Limitation of freezing the DOM, or is there a way to stack the transitions?
2 отметки «Нравится»

@devongovett
Yeah it’s a limitation of the current API but I think the spec authors are aware of it so hopefully it’ll get better eventually
4 отметки «Нравится»

@mustafaabobakr_
Is using the "flushSync" recommended for lists?
1 отметка «Нравится»

@devongovett
In this case it’s required for the view transition to take effect. The DOM updates have to occur inside that callback
4 отметки «Нравится»

@ZikriIsmal
can you drop that link pls? pretty excited to try it ...

@devongovett
No problem
1 отметка «Нравится»

@nasm423
Very very cool!