Skip to content

[BootstrapAdminUi] Port the sticky page header from Sylius - #413

Merged
TheMilek merged 1 commit into
Sylius:mainfrom
loic425:fix/bootstrap-admin-ui-sticky-header
Nov 23, 2026
Merged

TheMilek merged 1 commit into
Sylius:mainfrom
loic425:fix/bootstrap-admin-ui-sticky-header

Conversation

@loic425

@loic425 loic425 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member
Q A
Branch? main
Bug fix? yes
New feature? no
BC breaks? no
License MIT

On create and update pages, the form card is glued to the page header: the "Cancel" / "Update" buttons touch the card. The header has no bottom padding, and only the index pages render a .page-body with a top margin.

The Sylius admin solves it in CSS, with the same templates. This PR ports its _layout.scss and sticky-header.js as is (a follow-up listed in #404):

  • .page-header gets the page vertical padding, .page-body no longer adds its own margin: same 24px gap on every page;
  • the header sticks to the top while scrolling (border and shadow once stuck), so the form buttons stay visible. The header template already had the data-sticky-header attribute;
  • no template or hook change.

Measured on the demo, talk edit page: header → card 0px before, 24px after. Invalid form: header → alert 24px, alert → card 16px, as in Sylius. Index pages are unchanged (24px).

It keeps BootstrapAdminUi closer to the Sylius admin templates and styles, which should be merged at some point. It is an alternative to #401 and #375, which fix the same gap by changing the markup or the hooks.

public/ assets were rebuilt with yarn build.

Screenshots

Talk edit page of the demo application, default theme.

Valid form

valid-form

Invalid form

invalid-form

Sticky header, after scrolling

sticky-header

The create and update forms were glued to the page header: the header had no
bottom padding, and only the index pages render a ".page-body" with a top
margin.

Port "_layout.scss" and "sticky-header.js" from the Sylius admin, as is: the
page header gets the page vertical padding and sticks to the top of the page
(with a border and a shadow once stuck), and ".page-body" no longer adds its
own margin. The header template already had the "data-sticky-header"
attribute. Same spacing on every page, no markup change, and one difference
less with the Sylius admin.
Comment on lines +12 to +17
position: sticky;
top: -1px;
z-index: 999;
margin-top: 0;
padding-top: var(--tblr-page-padding-y);
padding-bottom: var(--tblr-page-padding-y);

@TheMilek TheMilek Nov 23, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
position: sticky;
top: -1px;
z-index: 999;
margin-top: 0;
padding-top: var(--tblr-page-padding-y);
padding-bottom: var(--tblr-page-padding-y);
margin-top: 0;
padding-top: var(--tblr-page-padding-y);
padding-bottom: var(--tblr-page-padding-y);
&[data-sticky-header] {
position: sticky;
top: -1px;
z-index: 999;
}

The header template only renders data-sticky-header when sticky_header is not disabled, but this rule makes every .page-header sticky. With sticky_header: false the header still sticks, it just never gets is-sticky, so it has no background and the form scrolls underneath the title and the buttons.

I checked it with the built assets from this PR

@TheMilek
TheMilek merged commit fc6571c into Sylius:main Nov 23, 2026
5 checks passed
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.

2 participants