Skip to content

Conversation

@dfsmania
Copy link
Contributor

Refactor Push Menu Plugin (AdminLTE v4)

This PR delivers a complete refactor of the Push Menu plugin, focusing on correctness, maintainability, and behavioral alignment with AdminLTE v3.

Summary of changes

1. Improved code documentation

  • Added detailed code comments across the Push Menu implementation.
  • The goal is to make the control flow and state transitions explicit and easier to reason about.
  • This is especially important for a component that mixes responsive logic, persistence, and DOM state.

2. Clear separation of responsibilities

  • Refactored the plugin logic into smaller, well-defined methods.
  • Each method now has a single responsibility (responsive handling, persistence, toggling, etc.).
  • This significantly improves readability and reduces the likelihood of regressions when modifying behavior.

3. Sidebar behavior aligned with AdminLTE v3

  • The sidebar-open class is now explicitly added when the sidebar is opened on mobile viewports.
  • This restores the behavior used in AdminLTE v3 and fixes inconsistencies introduced in v4.
  • Overall responsive logic now more closely mimics the v3 implementation, reducing unexpected behavior during resizing and navigation.

4. Sidebar state persistence is now opt-in

  • Sidebar state persistence is disabled by default.
  • Persistence can be enabled via a data attribute on the sidebar element:
<aside class="app-sidebar" data-enable-persistence="true"></aside>
  • This avoids unexpected UI state restoration and gives developers explicit control over the feature.

5. Single PushMenu instance

  • The plugin now creates and manages a single PushMenu instance.
  • Previously, multiple instances were created in different event handlers, leading to duplicated logic and harder-to-track state.
  • This change results in cleaner event handling and more predictable behavior.

Why this refactor?

The Push Menu is a core UI component that combines:

  • responsive behavior
  • DOM state
  • optional persistence
  • user interaction

This refactor aims to:

  • make the logic easier to follow
  • reduce side effects
  • restore proven v3 behavior
  • provide a stable foundation for future improvements

No visual regressions are expected, only more consistent and predictable behavior.

@netlify
Copy link

netlify bot commented Dec 24, 2025

Deploy Preview for adminlte-v4 ready!

Name Link
🔨 Latest commit 5d0b376
🔍 Latest deploy log https://app.netlify.com/projects/adminlte-v4/deploys/694c329afe3ec1000835d712
😎 Deploy Preview https://deploy-preview-5954--adminlte-v4.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@dfsmania
Copy link
Contributor Author

@puikinsh The Bundlewatch faill will dissapear when merging the #5953 PR. If you want to review the logic, I'll recommend to view the new raw file, instead of comparing differences, since this PR introduces a complete rework of the push menu plugin.

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.

1 participant