Sliding Menu for Bricks
Sliding Menu turns any WordPress menu into a drill-down list. Items with children slide their sub-menu in as a new panel, with a back button that says where it goes.
Version: 0.1.0 · Requires: Bricks Builder, WordPress 6.5+ and PHP 8.1+ · See the live demo
Please note: this is an early release. It has been run on this playground but not yet tested widely, so stage & back up before using it on a live site.
Using it
- Build your menu under Appearance, Menus.
- Add Sliding Menu and choose the menu.
- Place it inside a Bricks Offcanvas, a popup or any container.
Controls
- Menu: which menu, the back label on first-level sub-menus, the parent link label (
All %s), whether to add the parent page as the first link of its sub-menu, reset when hidden, look (light drawer, dark panel, soft grey card) and slide duration. - Style: width, background, border, item typography, colours, divider thickness, padding, arrows and the whole back area.
Accessibility
- Items with children are buttons with
aria-expanded,aria-haspopupandaria-controls. - Hidden panels are
inert. Focus moves to the back button on the way in and back to the item on the way out. - Escape goes back one level. Link targets are kept.
Limitations
- Menu items that have children cannot themselves be links; with the default setting the page is added as the first entry of its sub-menu.
- Without JavaScript every level is listed in order.
Scripting
SLM.reset(element) returns one instance to the main menu. SLM.refresh() sets up menus added later.
Changelog
- 0.1.0 — first release.