From 3aa01f8ff857334a44c026bd8439b8aea076a612 Mon Sep 17 00:00:00 2001 From: Aigars Silkalns Date: Mon, 30 Nov 2026 13:33:40 +0200 Subject: [PATCH] fix(blazor): re-run AdminLTE setup correctly; drop duplicate Bootstrap CSS; 0.4.1 - adminlte-blazor.js called Treeview/PushMenu/CardWidget.init, which don't exist in AdminLTE 4, so nothing re-initialised after Blazor replaced the prerendered layout (on phones the sidebar overlay no longer closed the sidebar). Use adminlte.initialize() and recreate a stale OverlayScrollbars instance. - DashboardLayout runs the setup once after the first interactive render, restores the scrollbar on later renders, and closes the sidebar after navigation on phones. - loads adminlte-blazor.js as a module that re-runs the setup on Blazor's enhancedload event (statically rendered pages). - Load before blazor.web.js (docs, demo) so href="#" toggles are not turned into navigation to "/"; the topbar user menu toggle is a button. - / no longer link bootstrap.min.css: adminlte.css already contains Bootstrap. - Sidebar: drop role="menu", add aria-current="page" on the current link. - README/NUGET: register the RequireAdmin policy the menu example uses. - Bundle AdminLTE 4.10.3. Version 0.4.1. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 37 ++++++ NUGET.md | 11 +- README.md | 11 +- RELEASING.md | 2 +- samples/AdminLte.Demo/Components/App.razor | 5 +- samples/AdminLte.Demo/appsettings.json | 2 +- .../ColorlibHQ.AdminLTE.AspNetCore.csproj | 4 +- .../Components/AdminLteScripts.razor | 14 +- .../Components/AdminLteStyles.razor | 4 +- .../Components/Layout/DashboardLayout.razor | 20 ++- .../Components/Layout/SidebarNav.razor | 3 +- .../Components/Layout/SidebarNavItem.razor | 3 +- .../Components/Layout/Topbar.razor | 6 +- .../TagHelpers/AdminLteSidebarTagHelper.cs | 5 +- .../TagHelpers/AdminLteStylesTagHelper.cs | 5 +- .../wwwroot/css/adminlte.css | 120 ++++++++++++------ .../wwwroot/css/adminlte.min.css | 4 +- .../wwwroot/css/adminlte.rtl.min.css | 4 +- .../wwwroot/js/adminlte-blazor.js | 77 ++++++++--- .../wwwroot/js/adminlte.js | 105 +++++++++++++-- .../wwwroot/js/adminlte.min.js | 4 +- 21 files changed, 339 insertions(+), 107 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9dc509..71031eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,43 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.4.1] - 2026-11-30 + +### Fixed + +- **The Blazor glue called AdminLTE functions that don't exist.** `adminlte-blazor.js` + called `Treeview.init`, `PushMenu.init` and `CardWidget.init`, which AdminLTE 4 + doesn't have, so nothing was re-initialised after Blazor replaced the prerendered + layout. On phones, tapping outside the open sidebar no longer closed it. The glue now + calls `adminlte.initialize()`, which removes the previous run's listeners before it + runs again, and recreates the sidebar's OverlayScrollbars instance when a DOM patch + removed it. `DashboardLayout` runs it once after the first interactive render + instead of on every render. +- **Statically rendered pages lost AdminLTE's setup after enhanced navigation.** + `` now also loads `adminlte-blazor.js` as a module, which re-runs + the setup on Blazor's `enhancedload` event. +- **Menu groups and dropdowns could navigate to the home page.** With + `blazor.web.js` loaded first, Blazor treated clicks on `href="#"` toggles as + navigation to `/` (via ``) on statically rendered pages. The docs and + the demo now load `` before `blazor.web.js`, and the topbar user + menu toggle is a `