Skip to content

Commit

Permalink
use requestAnimationFrame for fade-in effect
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoskolodny committed Nov 11, 2024
1 parent b9a0ca8 commit dd61e23
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/navigation-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,8 @@ const MainNavigationBarDesktopMenuContent = ({
// If menu is opening, trigger the fade-in effect for current section
if (menuStatus === 'opening') {
setIsContentVisible(false);
setTimeout(() => setIsContentVisible(true), 0);
const id = requestAnimationFrame(() => setIsContentVisible(true));
return () => cancelAnimationFrame(id);
} else {
setIsContentVisible(true);
}
Expand Down

0 comments on commit dd61e23

Please sign in to comment.