From 9e1a75402fd4286d54be21af12ce05722ce06f56 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Tue, 4 Aug 2026 07:36:47 -0700 Subject: [PATCH] Fix dialog context error in language popover by using DialogTrigger --- src/components/input/LanguageButton.tsx | 39 +++++++++++++------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/src/components/input/LanguageButton.tsx b/src/components/input/LanguageButton.tsx index bf5c9ff26..53fca3063 100644 --- a/src/components/input/LanguageButton.tsx +++ b/src/components/input/LanguageButton.tsx @@ -1,4 +1,4 @@ -import { Button, Dialog, Grid, Icon, MenuTrigger, Popover, Text } from '@umami/react-zen'; +import { Button, Dialog, DialogTrigger, Grid, Icon, Popover, Text } from '@umami/react-zen'; import { Globe } from 'lucide-react'; import { useLocale } from '@/components/hooks'; import { languages } from '@/lib/lang'; @@ -7,12 +7,13 @@ export function LanguageButton() { const { locale, saveLocale } = useLocale(); const items = Object.keys(languages).map(key => ({ ...languages[key], value: key })); - function handleSelect(value: string) { + function handleSelect(value: string, close: () => void) { saveLocale(value); + close(); } return ( - + - - {items.map(({ value, label }) => { - return ( - - ); - })} - + {({ close }) => ( + + {items.map(({ value, label }) => { + return ( + + ); + })} + + )} - + ); }