Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix(frontend): restore z-50 on Select/Tooltip so they render above Dialog (#19959)

Danny Xu6141cd9e3c1c
diff --git a/frontend/AGENTS.md b/frontend/AGENTS.md
index 7f0221f590..122d4e2209 100644
--- a/frontend/AGENTS.md
+++ b/frontend/AGENTS.md
@@ -32,7 +32,7 @@ React UI components live in `src/react/components/ui/` and follow shadcn-style p
- **Use `truncate` shorthand** — not `overflow-hidden text-ellipsis whitespace-nowrap`
- **Use `cn()` for conditional classes** — import from `@/react/lib/utils`, don't write manual template literal ternaries
- **No manual `dark:` overrides** — use semantic tokens that handle theming
-- **No manual `z-index` on overlays** — Dialog, Sheet, Popover handle their own stacking
+- **No manual `z-index` on overlay *consumers*** — callers of `Dialog`, `Sheet`, `Popover`, `Select`, `Tooltip` must not set their own `z-index`. The primitives in `src/react/components/ui/` already coordinate stacking (all overlays use `z-50`; within that layer, later-mounted portals win by DOM order). Do **not** strip `z-50` from `select.tsx`, `tooltip.tsx`, `dialog.tsx`, or `alert-dialog.tsx` — removing it makes Select/Tooltip render behind Dialog (BYT-9226, PR #19824)
### Component Patterns
diff --git a/frontend/src/react/components/ui/dialog.tsx b/frontend/src/react/components/ui/dialog.tsx
index 1fd37712f6..74a37acad1 100644
--- a/frontend/src/react/components/ui/dialog.tsx
+++ b/frontend/src/react/components/ui/dialog.tsx
@@ -9,6 +9,11 @@ const Dialog = BaseDialog.Root;
const DialogTrigger = BaseDialog.Trigger;
// ---- Overlay / Backdrop ----
+// Dialog, Select, Tooltip, and AlertDialog all use `z-50`. Within that shared
+// z-layer, stacking falls back to DOM portal mount order — later mounts win —
+// which correctly places a Select/Tooltip opened *inside* a Dialog on top of
+// the dialog backdrop. Do not bump Dialog above z-50 (or other overlays below)
+// without updating all four components together. See BYT-9226 / PR #19824.
function DialogOverlay({
className,
ref,
diff --git a/frontend/src/react/components/ui/select.tsx b/frontend/src/react/components/ui/select.tsx
index af6aedc404..1c4be27083 100644
--- a/frontend/src/react/components/ui/select.tsx
+++ b/frontend/src/react/components/ui/select.tsx
@@ -36,6 +36,13 @@ function SelectTrigger({
const SelectValue = BaseSelect.Value;
// ---- Portal + Positioner + Popup ----
+// The `z-50` on the Positioner matches the z-index used by Dialog/AlertDialog
+// (see ui/dialog.tsx). It must not be removed — Dialog's backdrop/popup are
+// hardcoded at z-50, so a Select without an explicit z-index renders *behind*
+// any open Dialog regardless of DOM portal order (z-auto loses to z-50).
+// Within the same z-layer, stacking falls back to DOM order, which correctly
+// puts later-mounted portals (e.g. a Select opened inside a Dialog) on top.
+// See BYT-9226 and PR #19824 for the original regression.
function SelectContent({
className,
children,
@@ -44,7 +51,7 @@ function SelectContent({
}: ComponentProps<typeof BaseSelect.Popup>) {
return (
<BaseSelect.Portal>
- <BaseSelect.Positioner sideOffset={4}>
+ <BaseSelect.Positioner sideOffset={4} className="z-50">
<BaseSelect.Popup
ref={ref}
className={cn(
diff --git a/frontend/src/react/components/ui/tooltip.tsx b/frontend/src/react/components/ui/tooltip.tsx
index 959579cae6..bf0c955595 100644
--- a/frontend/src/react/components/ui/tooltip.tsx
+++ b/frontend/src/react/components/ui/tooltip.tsx
@@ -26,7 +26,7 @@ export function Tooltip({
</BaseTooltip.Trigger>
<BaseTooltip.Portal>
<BaseTooltip.Positioner side={side} sideOffset={4}>
- <BaseTooltip.Popup className="max-w-56 rounded-sm bg-main px-2.5 py-1.5 text-xs text-main-text shadow-md">
+ <BaseTooltip.Popup className="z-50 max-w-56 rounded-sm bg-main px-2.5 py-1.5 text-xs text-main-text shadow-md">
{content}
<BaseTooltip.Arrow className="fill-main" />
</BaseTooltip.Popup>
@@ -60,7 +60,7 @@ export function BlockTooltip({
</BaseTooltip.Trigger>
<BaseTooltip.Portal>
<BaseTooltip.Positioner side={side} sideOffset={4}>
- <BaseTooltip.Popup className="max-w-56 rounded-sm bg-main px-2.5 py-1.5 text-xs text-main-text shadow-md">
+ <BaseTooltip.Popup className="z-50 max-w-56 rounded-sm bg-main px-2.5 py-1.5 text-xs text-main-text shadow-md">
{content}
<BaseTooltip.Arrow className="fill-main" />
</BaseTooltip.Popup>