don't portal popover

This commit is contained in:
Josh Hawkins 2025-11-06 09:07:44 -06:00
parent 24b514ec14
commit cd399f6c67
4 changed files with 28 additions and 8 deletions

View File

@ -156,6 +156,7 @@ export function AnnotationSettingsPane({
<Trans ns="views/explore"> <Trans ns="views/explore">
trackingDetails.annotationSettings.offset.millisecondsToOffset trackingDetails.annotationSettings.offset.millisecondsToOffset
</Trans> </Trans>
<FormMessage />
<div className="mt-2"> <div className="mt-2">
{t("trackingDetails.annotationSettings.offset.tips")} {t("trackingDetails.annotationSettings.offset.tips")}
<div className="mt-2 flex items-center text-primary"> <div className="mt-2 flex items-center text-primary">
@ -183,7 +184,6 @@ export function AnnotationSettingsPane({
</FormControl> </FormControl>
</div> </div>
</div> </div>
<FormMessage />
</FormItem> </FormItem>
)} )}
/> />
@ -192,6 +192,7 @@ export function AnnotationSettingsPane({
<div className="flex flex-row gap-2 pt-5"> <div className="flex flex-row gap-2 pt-5">
<Button <Button
className="flex flex-1" className="flex flex-1"
variant="default"
aria-label={t("button.apply", { ns: "common" })} aria-label={t("button.apply", { ns: "common" })}
onClick={form.handleSubmit(onApply)} onClick={form.handleSubmit(onApply)}
> >

View File

@ -49,7 +49,7 @@ export default function DetailActionsMenu({
return ( return (
<DropdownMenu open={isOpen} onOpenChange={setIsOpen}> <DropdownMenu open={isOpen} onOpenChange={setIsOpen}>
<DropdownMenuTrigger> <DropdownMenuTrigger>
<div className="rounded p-1 pr-2" role="button"> <div className="rounded" role="button">
<HiDotsHorizontal className="size-4 text-muted-foreground" /> <HiDotsHorizontal className="size-4 text-muted-foreground" />
</div> </div>
</DropdownMenuTrigger> </DropdownMenuTrigger>

View File

@ -252,10 +252,11 @@ function AnnotationSettings({
<Content <Content
className={ className={
isDesktop isDesktop
? "w-[90vw] max-w-md p-0" ? "w-[90vw] max-w-md bg-background_alt p-0"
: "mx-1 max-h-[75dvh] overflow-hidden rounded-t-2xl px-4 pb-4" : "mx-1 max-h-[75dvh] overflow-hidden rounded-t-2xl px-4 pb-4"
} }
{...contentProps} {...contentProps}
{...(isDesktop ? { disablePortal: true } : {})}
data-annotation-popover data-annotation-popover
> >
<AnnotationSettingsPane <AnnotationSettingsPane

View File

@ -11,13 +11,21 @@ const PopoverContent = React.forwardRef<
React.ElementRef<typeof PopoverPrimitive.Content>, React.ElementRef<typeof PopoverPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> & { React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> & {
container?: HTMLElement | null; container?: HTMLElement | null;
disablePortal?: boolean;
} }
>( >(
( (
{ className, container, align = "center", sideOffset = 4, ...props }, {
className,
container,
disablePortal = false,
align = "center",
sideOffset = 4,
...props
},
ref, ref,
) => ( ) => {
<PopoverPrimitive.Portal container={container}> const content = (
<PopoverPrimitive.Content <PopoverPrimitive.Content
ref={ref} ref={ref}
align={align} align={align}
@ -28,8 +36,18 @@ const PopoverContent = React.forwardRef<
)} )}
{...props} {...props}
/> />
);
if (disablePortal) {
return content;
}
return (
<PopoverPrimitive.Portal container={container}>
{content}
</PopoverPrimitive.Portal> </PopoverPrimitive.Portal>
), );
},
); );
PopoverContent.displayName = PopoverPrimitive.Content.displayName; PopoverContent.displayName = PopoverPrimitive.Content.displayName;