Skip to content

Commit 3f2dbd7

Browse files
authored
fix(web): tapping away from the model picker on a phone no longer presses what is under it (pingdotgg#20841)
1 parent 0bdb5a8 commit 3f2dbd7

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎apps/web/src/components/chat/ProviderModelPicker.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ export const ProviderModelPicker = memo(function ProviderModelPicker(props: {
278278
align="start"
279279
className="before:hidden"
280280
padding="none"
281+
touchBackdrop
281282
>
282283
<ModelPickerContent
283284
environmentId={props.environmentId}

‎apps/web/src/components/ui/popover.tsx‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ function PopoverPopup({
4343
tooltipStyle = false,
4444
keepMounted = false,
4545
anchor,
46+
touchBackdrop = false,
4647
...props
4748
}: PopoverPrimitive.Popup.Props & {
4849
padding?: keyof typeof popoverViewportPaddingClassName;
@@ -56,12 +57,22 @@ function PopoverPopup({
5657
keepMounted?: PopoverPrimitive.Portal.Props["keepMounted"];
5758
anchor?: PopoverPrimitive.Positioner.Props["anchor"];
5859
width?: keyof typeof popoverPopupWidthClassName;
60+
touchBackdrop?: boolean;
5961
}) {
6062
// Viewport rekeys its children when the active trigger clears on close. Persistent
6163
// single-trigger forms need a stable container to retain drafts and submit guards.
6264
const Viewport = keepMounted ? "div" : PopoverPrimitive.Viewport;
6365
return (
6466
<PopoverPrimitive.Portal keepMounted={keepMounted}>
67+
{touchBackdrop ? (
68+
// A non-modal popover closes on an outside tap and lets that tap reach the
69+
// control under the finger. On touch screens the backdrop takes the tap, so
70+
// tapping away only closes the popover, as it does for modal menus and selects.
71+
<PopoverPrimitive.Backdrop
72+
className="fixed inset-0 z-[130] hidden pointer-coarse:block"
73+
data-slot="popover-backdrop"
74+
/>
75+
) : null}
6576
<PopoverPrimitive.Positioner
6677
align={align}
6778
alignOffset={alignOffset}

0 commit comments

Comments
 (0)