Repository navigation
Fix Blazor re-initialisation, duplicate Bootstrap CSS and sidebar a11y (0.4.1) - #2
Merged
Merged
Conversation
…p 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. - <AdminLteScripts /> loads adminlte-blazor.js as a module that re-runs the setup on Blazor's enhancedload event (statically rendered pages). - Load <AdminLteScripts /> before blazor.web.js (docs, demo) so href="#" toggles are not turned into navigation to "/"; the topbar user menu toggle is a button. - <adminlte-styles>/<AdminLteStyles /> 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 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problems fixed
adminlte-blazor.jscalledadminlte.Treeview.init,PushMenu.initandCardWidget.init. None of these exist in AdminLTE 4, so the calls did nothing. As a result, on aspnet.adminlte.io at phone width, tapping outside the open sidebar did not close it. The glue now callsadminlte.initialize(), which removes the previous run's listeners before running again. It also recreates the sidebar's OverlayScrollbars instance when a DOM patch has removed it.<AdminLteScripts />now loads the glue as a module, which re-runs the setup on Blazor'senhancedloadevent.href="#"toggles could go to the home page. Withblazor.web.jsloaded first, Blazor turned these clicks into navigation to/. The docs and demo now load<AdminLteScripts />first, and the topbar user-menu toggle is now a<button>.DashboardLayoutnow closes it after an interactive navigation.<adminlte-styles>and<AdminLteStyles />no longer linkbootstrap.min.css;adminlte.min.cssalready contains Bootstrap.role="menu"is removed, matching AdminLTE 4.10.3. The current link now getsaria-current="page".RequireAdminpolicy without registering it; the example now registers it.The bundle moves to AdminLTE 4.10.3 and the version to 0.4.1.
Tests
All run on the .NET 10 SDK with Playwright (Chromium).
Demo (interactive server):
/widgets/small-boxesstays on that page.role="menu", nobootstrap.min.css, and no JS errors.Static SSR app (
dotnet new blazor -int None+DashboardLayout):/reports/salesstay on the page.blazor.web.js), the same group click navigates to/, which reproduces the bug.MVC app using the Tag Helpers:
bootstrap.min.css.aria-currentis rendered androle="menu"is gone.Build and package:
dotnet build -c Release: 0 errors; the one warning (IL2026) was already there.dotnet packproduces 0.4.1.🤖 Generated with Claude Code