Skip to content

Commit f9a1b26

Browse files
committed
fix: header fixed positioning, content spacing, and dynamic height tracking
- Change 'fixed' behavior to use 'fixed' instead of 'sticky' for reliable screen pinning. - Add dynamic --header-height CSS variable synced via ResizeObserver. - Add automatic content padding in AppShell based on header height. - Fix PanelTop import in fixed-header example. - Update unit tests to reflect positioning changes.
1 parent d6356a2 commit f9a1b26

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

packages/react/__tests__/Header.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ describe("Header", () => {
7676
expect(header?.className).not.toContain("sticky");
7777
});
7878

79-
it("renders fixed header with sticky", () => {
79+
it("renders fixed header with fixed positioning", () => {
8080
const { container } = renderHeader({ behavior: "fixed" });
8181
const header = container.querySelector("header");
82-
expect(header?.className).toContain("sticky");
82+
expect(header?.className).toContain("fixed");
8383
});
8484
});
8585

packages/react/src/AppShell.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ function AppShellInner({ safeArea = false, className, children }: AppShellProps)
3838
});
3939

4040
return (
41-
<div className={cn("flex min-h-dvh flex-col relative", className)}>
41+
<div
42+
className={cn("flex min-h-dvh flex-col relative", className)}
43+
style={{ paddingTop: "var(--header-height, 0px)" }}
44+
>
4245
{header}
4346
<SafeArea edges={["bottom"]} className="flex flex-col flex-1">
4447
{otherChildren}

packages/react/src/Header.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,10 @@ export const Header = memo(function Header({
266266
<header
267267
ref={ghostRef}
268268
className={cn(
269-
"w-full sticky top-0 z-50 transition-colors duration-300",
269+
"w-full fixed top-0 left-0 right-0 z-50 transition-colors duration-300",
270270
t.wrapper,
271271
className
272272
)}
273-
style={{ paddingTop: "env(safe-area-inset-top, 0px)" }}
274273
>
275274
<HeaderProvider value={{ theme }}>
276275
{renderNavRow()}

0 commit comments

Comments
 (0)