Skip to content

spike(#3347): Add stickyHeader prop to Container#3629

Draft
Copilot wants to merge 3 commits intodevfrom
copilot/add-sticky-header-to-container
Draft

spike(#3347): Add stickyHeader prop to Container#3629
Copilot wants to merge 3 commits intodevfrom
copilot/add-sticky-header-to-container

Conversation

Copy link
Contributor

Copilot AI commented Mar 20, 2026

Adds stickyHeader boolean prop to goa-container as a concrete example of approach 3 (sticky behavior on individual existing components) for the sticky header/footer spike. Also fixes a pre-existing layout bug where the container header would collapse to an incorrect height when maxHeight was set.

Before (the change)

  • Container had no sticky header capability
  • Container header would shrink/collapse when maxHeight was applied to the container, due to the header lacking flex-shrink: 0 in the flex-column layout

After (the change)

  • Container.sveltestickyHeader prop registers a scroll listener on .content; applies position: sticky; top: 0; z-index: 1 to the header and a box-shadow when content has scrolled past the top. Added flex-shrink: 0 to the header so it always maintains its full height regardless of any maxHeight constraint on the container.
  • React wrapperstickyHeader?: booleanstickyheader="true" attribute
  • Angular wrapper@Input() stickyHeader?: boolean[attr.stickyheader]
  • Tests — all three frameworks verify the prop is wired correctly
  • PR playgroundfeat3347.tsx with three test cases (internal scroll via maxHeight, page scroll, and default/no-sticky comparison)

Usage:

// Internal scroll — header stays pinned, shadow appears on scroll
<GoabContainer stickyHeader maxHeight="400px" title="Section">
  {/* long content */}
</GoabContainer>

// Page scroll — header sticks to viewport top as user scrolls down
<GoabContainer stickyHeader title="Section">
  {/* long content */}
</GoabContainer>

All three test cases with correct header heights:

Tests 1 and 2 with correct header heights

Make sure that you've checked the boxes below before you submit the PR

  • I have read and followed the setup steps
  • I have created necessary unit tests
  • I have tested the functionality in both React and Angular.

Steps needed to test

  1. npm run serve:prs:react
  2. Navigate to 3347 Container Sticky Header in the sidebar
  3. Verify Test 1: scroll inside the height-capped container — header stays visible at full height and a shadow appears below it when scrolled
  4. Verify Test 2: scroll the page — header sticks to viewport top
  5. Verify Test 3: default container (no stickyHeader) with maxHeight — header renders at correct full height

⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.

@netlify
Copy link

netlify bot commented Mar 20, 2026

Deploy Preview for goa-design-2 ready!

Name Link
🔨 Latest commit 65e1646
🔍 Latest deploy log https://app.netlify.com/projects/goa-design-2/deploys/69bdb44d0dd6d2000954ec08
😎 Deploy Preview https://deploy-preview-3629--goa-design-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Adds a `stickyHeader` boolean prop to goa-container (and React/Angular
wrappers) as an example of approach 3 (sticky header on individual
components) for issue #3347.

When stickyHeader=true:
- Header uses position:sticky; top:0; z-index:1 to stay visible on scroll
- Scroll listener on .content tracks position; a shadow appears under the
  header when content has been scrolled past the top

Closes #3347

Co-authored-by: bdfranck <1479091+bdfranck@users.noreply.github.com>
Agent-Logs-Url: https://github.com/GovAlta/ui-components/sessions/bd9db423-c26f-49b1-83c1-07e1af9d48ea
Copilot AI changed the title [WIP] Add sticky header to Container.svelte component feat(#3347): Add stickyHeader prop to Container component Mar 20, 2026
Copilot AI requested a review from bdfranck March 20, 2026 21:06
@bdfranck
Copy link
Collaborator

@copilot The header for test 2 looks good.

image

But the headers for tests 1 and 3 are too thin.

image image

Add flex-shrink:0 to the header element so it maintains its full height
when a maxHeight constraint is applied to the container. Previously the
flexbox algorithm would compress the header alongside the content area,
making it too thin.

Co-authored-by: bdfranck <1479091+bdfranck@users.noreply.github.com>
Agent-Logs-Url: https://github.com/GovAlta/ui-components/sessions/f2c970fb-9fff-467c-ae48-11232eef0f30
Copy link
Contributor Author

Copilot AI commented Mar 20, 2026

@copilot The header for test 2 looks good.

image

...

Fixed in ecec5a0. The root cause was that the header element lacked flex-shrink: 0, so when a maxHeight constraint was applied to the flex-column container, the flexbox algorithm was compressing the header alongside the content. Adding flex-shrink: 0 to the header ensures it always maintains its full height regardless of the container's height constraint.

All three tests now render with correct header heights:

Test 1 & 2 headers fixed

@bdfranck bdfranck changed the title feat(#3347): Add stickyHeader prop to Container component spike(#3347): Add stickyHeader prop to Container component Mar 21, 2026
@bdfranck bdfranck linked an issue Mar 23, 2026 that may be closed by this pull request
@bdfranck bdfranck changed the title spike(#3347): Add stickyHeader prop to Container component spike(#3347): Add stickyHeader prop to Container Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create reusable sticky header/footer component

2 participants