Skip to content

Commit 4059638

Browse files
stewxalextran1502
andauthored
fix: context menu jank (immich-app#21844)
* Fix issue with context menu jank by only applying overflow styling when transition is complete * Remove comment Co-authored-by: Alex <alex.tran1502@gmail.com> --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
1 parent 1823a28 commit 4059638

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

web/src/lib/components/shared-components/context-menu/context-menu.svelte

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
// of zero when starting the 'slide' animation.
4141
let height: number = $state(0);
4242
43+
let isTransitioned = $state(false);
44+
4345
$effect(() => {
4446
if (menuElement) {
4547
let layoutDirection = direction;
@@ -64,6 +66,12 @@
6466
style:top="{top}px"
6567
transition:slide={{ duration: 250, easing: quintOut }}
6668
use:clickOutside={{ onOutclick: onClose }}
69+
onintroend={() => {
70+
isTransitioned = true;
71+
}}
72+
onoutrostart={() => {
73+
isTransitioned = false;
74+
}}
6775
>
6876
<ul
6977
{id}
@@ -73,7 +81,9 @@
7381
bind:this={menuElement}
7482
class="{isVisible
7583
? 'max-h-dvh'
76-
: 'max-h-0'} flex flex-col transition-all duration-250 ease-in-out outline-none overflow-auto"
84+
: 'max-h-0'} flex flex-col transition-all duration-250 ease-in-out outline-none {isTransitioned
85+
? 'overflow-auto'
86+
: ''}"
7787
role="menu"
7888
tabindex="-1"
7989
>

0 commit comments

Comments
 (0)