Skip to content

Commit d994b53

Browse files
shivamhwpclaude
andcommitted
fix(web): keep the command palette clear of the native window controls
The palette sits 4vh or 10vh from the top. In the short windows the new desktop minimum allows, that put its search field under the Windows and Linux caption buttons or the macOS traffic lights. Its top inset now never drops below the native titlebar height. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 663a401 commit d994b53

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { SearchIcon } from "lucide-react";
33
import { useRef } from "react";
44
import type * as React from "react";
55
import { cn } from "~/lib/utils";
6+
import { useNativeTitlebarHeight } from "~/lib/windowControlsOverlay";
67
import {
78
Autocomplete,
89
AutocompleteCollection,
@@ -36,13 +37,19 @@ function CommandDialogBackdrop({ className, ...props }: CommandDialogPrimitive.B
3637
}
3738

3839
function CommandDialogViewport({ className, ...props }: CommandDialogPrimitive.Viewport.Props) {
40+
// Short desktop windows would put the search field under the native window controls.
41+
const nativeTitlebarHeight = useNativeTitlebarHeight();
42+
const titlebarStyle = {
43+
"--command-titlebar-height": `${nativeTitlebarHeight}px`,
44+
} as React.CSSProperties;
3945
return (
4046
<CommandDialogPrimitive.Viewport
4147
className={cn(
42-
"pointer-events-none fixed inset-0 z-50 flex flex-col items-center px-4 py-[max(--spacing(4),4vh)] sm:py-[10vh]",
48+
"pointer-events-none fixed inset-0 z-50 flex flex-col items-center px-4 pt-[max(--spacing(4),4vh,calc(var(--command-titlebar-height)+--spacing(2)))] pb-[max(--spacing(4),4vh)] sm:pt-[max(10vh,calc(var(--command-titlebar-height)+--spacing(2)))] sm:pb-[10vh]",
4349
className,
4450
)}
4551
data-slot="command-dialog-viewport"
52+
style={titlebarStyle}
4653
{...props}
4754
/>
4855
);

0 commit comments

Comments
 (0)