Repository navigation
Release v2.6.0
Release 2.6.0
Changelog
Added
- Nested menu collapse without Bootstrap JS (
js/menu-collapse.js, opt-in; spec003-menu-collapse-without-bootstrap): a dependency-free script (≈1.6 kB gzip) that makes the menu'sdata-bs-toggle="collapse"markup work on hosts that do not load Bootstrap's JavaScript. One delegated click listener per[data-dashboard-menu-collapse]root (CSP-safe: external script, no inline handlers);aria-expanded/aria-controlskept in sync, closed panelsinert+aria-hidden,<li>is-expanded/is-collapsed; open / closed state remembered per menu code inlocalStorage; ancestors of the current item always open; connects onDOMContentLoaded/turbo:load/turbo:frame-load; eventdashboard-menu:collapse-toggle;window.NowoDashboardMenuCollapse.init(). ES module (src/Resources/assets/src/menu-collapse.ts) for bundler hosts. - No double toggle next to Bootstrap JS: mode
auto(default) never toggles whilewindow.bootstrap.Collapse/jQuery.fn.collapseis loaded and only mirrorsshow|shown|hidden.bs.collapseinto ARIA /inert/ storage; modealwaystakes the toggles over (removes theirdata-bs-toggle). - Config
menu_collapse:enabled(defaultfalse),mode(auto|always),storage_key(defaultnowo.dashboardMenu.navCollapse,""= no persistence). Parameter%nowo_dashboard_menu.menu_collapse%, Twig globalnowo_dashboard_menu_collapse. menu.html.twig: when enabled, the menu root getsdata-dashboard-menu-collapse="<code>",-mode,-storage-key,-branch-class(fromclass_branch_expanded); include variablesmenuCollapse,menuCollapseMode,menuCollapseStorageKeyoverride the config.- Partial
@NowoDashboardMenuBundle/_menu_collapse_script.html.twig(externaldeferscript with the requestcsp_nonce). - Vite entry
menu-collapse(pnpm run build/build:menu-collapse); Vitest suite at 100% coverage.
Changed
menu.html.twigno longer callsdashboard_menu_config()whenmenuConfigis passed (Twig|default()evaluated its argument eagerly). Output unchanged.- Dev: Rector
LocallyCalledStaticMethodToNonStaticRectorapplied toTranslationKeyParityTest(behaviour-neutral).
Dependencies
- Development lock:
nowo-tech/form-kit-bundle2.12.0,nowo-tech/ui-kit-bundle1.14.0,doctrine/persistence4.2.1,nowo-tech/phpstan-frankenphp1.3.0. Democonfig/reference.phpregenerated (menu_collapse).
Default output is unchanged: without menu_collapse.enabled / menuCollapse no attribute is emitted and nothing has to be included.
Full Changelog: v2.5.1...v2.6.0