Skip to content

Panel: edit-page sidebar scrolls with the page and pins when its end is in view - #2740

Draft
glennjacobs wants to merge 1 commit into
2.xfrom
fix/panel-sticky-sidebar
Draft

glennjacobs wants to merge 1 commit into
2.xfrom
fix/panel-sticky-sidebar

Conversation

@glennjacobs

Copy link
Copy Markdown
Contributor

Summary

On the edit pages the right-hand column was position: sticky; top: 60px. When the column is taller than the viewport that pins it at the top and it only scrolls once the main column reaches its end, so cards lower down (including any an add-on injects into the sidebar zones) go unseen.

This adds a StickySidebar component and uses it on all seven edit pages (products, variants, brands, collections, product types, customers, product options):

  • When the column fits in the viewport it pins below the breadcrumb bar exactly as before.
  • When it is taller, its sticky top is set to the negative overflow, so the column scrolls with the page straight away and pins when its last card reaches the bottom of the viewport.

The height is measured live with a ResizeObserver (plus window resize), so nothing is hard-coded and cards added by add-ons at runtime are accounted for. The component is exported from @lunarphp/panel for add-on pages.

Split out of #2732 at review; #2732 will rebase onto this.

Test plan

  • npx vitest run in packages/panel (343 passed, 3 new cases: fits, overflows, resize)
  • npm run type-check, npm run build (compiled bundle committed)
  • vendor/bin/pest tests/panel/Unit/PageScaffoldTest.php
  • Manual: open a product with a long sidebar, scroll, confirm the column moves immediately and stops at its end

🤖 Generated with Claude Code

…nd is in view

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant