fix switching between different popovers for texts

This commit is contained in:
Ryan Di
2025-08-28 16:43:42 +10:00
parent ab3e2d7074
commit 8325f4bd3a
5 changed files with 119 additions and 21 deletions

View File

@@ -103,7 +103,18 @@ export const FontPicker = React.memo(
)}
{!compactMode && <ButtonSeparator />}
<Popover.Root open={isOpened} onOpenChange={onPopupChange}>
<FontPickerTrigger selectedFontFamily={selectedFontFamily} />
<FontPickerTrigger
selectedFontFamily={selectedFontFamily}
onTrigger={() => {
if (isOpened) {
onPopupChange(false);
} else {
// switch from any open popup: close then open next tick
onPopupChange(false);
setTimeout(() => onPopupChange(true), 0);
}
}}
/>
{isOpened && (
<FontPickerList
selectedFontFamily={selectedFontFamily}