Skip to content

[BootstrapAdminUi] Only stick the page header when sticky_header is enabled - #415

Open
loic425 wants to merge 2 commits into
Sylius:mainfrom
loic425:fix/bootstrap-admin-ui-sticky-header-opt-out
Open

loic425 wants to merge 2 commits into
Sylius:mainfrom
loic425:fix/bootstrap-admin-ui-sticky-header-opt-out

Conversation

@loic425

@loic425 loic425 commented Nov 24, 2026 •

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

Follow-up of #413, from TheMilek's review comment.

sticky_header: false has no effect: the header always sticks.

  • the template reads hookable_configuration, which is never defined (twig-hooks exposes hookable_metadata.configuration), and |default(true) turns false into true, so data-sticky-header is always rendered;
  • the CSS makes every .page-header sticky anyway, so a header without the attribute would still stick, but without is-sticky it has no background and the form scrolls under the title and the buttons.

Changes:

  • the BootstrapAdminUi and ShadcnAdminUi templates use hookable_metadata.configuration.sticky_header ?? true;
  • position: sticky moves to .page-header[data-sticky-header];
  • the vertical padding stays on every .page-header, so the 24px gap from [BootstrapAdminUi] Port the sticky page header from Sylius #413 is kept;
  • public/ assets were rebuilt with yarn build.

Same fix for the Sylius admin: Sylius/Sylius#19362.

@camilleislasse

Copy link
Copy Markdown
Contributor

The CSS fix is right, but it has no effect yet, the Twig condition never evaluates to false.

{% if hookable_configuration.sticky_header|default(true) %}
  • hookable_configuration doesn't exist, it should be hookable_metadata.configuration.
  • |default(true) also turns false into true.

So sticky_header: false is ignored and the header is always sticky. The same line is in ShadcnAdminUi.

Suggested fix in:

  • src/BootstrapAdminUi/templates/shared/crud/common/content/header.html.twig
  • src/ShadcnAdminUi/templates/shared/crud/common/content/header.html.twig
{% if hookable_metadata.configuration.sticky_header ?? true %}data-sticky-header{% endif %}

Tested with your CSS: with false the header scrolls normally, and the default stays sticky

@loic425

loic425 commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Good catch, thanks! Fixed in both BootstrapAdminUi and ShadcnAdminUi templates with your suggestion, and the description is updated.

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