Include Aurora nav section in the sidebar's single-open accordion (v2.3.1)
Aurora's branded nav section had its own independent expand/collapse state, so it stayed open regardless of which native menu section was expanded — the one exception to the single-open accordion. Unified under one openId ref (a sentinel value for Aurora alongside real native-menu item ids) so expanding either collapses the other. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
39af8d650d
commit
1578481106
@@ -5,6 +5,15 @@ version bump. Starts at 2.1.0 — earlier history (the theming rebuild,
|
|||||||
window chrome/taskbar, Site Editor support, etc.) lives in `git log` and
|
window chrome/taskbar, Site Editor support, etc.) lives in `git log` and
|
||||||
`PROJECT_STATUS.md`, not reconstructed here.
|
`PROJECT_STATUS.md`, not reconstructed here.
|
||||||
|
|
||||||
|
## [2.3.1] - 2026-07-04
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Sidebar accordion now treats the "Aurora" branded nav section as part of
|
||||||
|
the same single-open accordion as the WP-native menu list, instead of
|
||||||
|
being the one exception that stayed open regardless of what else was
|
||||||
|
expanded. Expanding any native section now collapses Aurora too, and
|
||||||
|
vice versa.
|
||||||
|
|
||||||
## [2.3.0] - 2026-07-04
|
## [2.3.0] - 2026-07-04
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "aurora-admin-app",
|
"name": "aurora-admin-app",
|
||||||
"version": "2.3.0",
|
"version": "2.3.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -63,11 +63,28 @@ const isSectionActive = (item) => {
|
|||||||
return (item.submenu || []).some((sub) => normalize(sub.url) === current.value);
|
return (item.submenu || []).some((sub) => normalize(sub.url) === current.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Accordion: only one section's submenu open at a time, so expanding one
|
// Accordion: only one section's submenu open at a time — the WP-native
|
||||||
// closes the rest instead of the list growing indefinitely. Starts on
|
// menu list and the Aurora branded section below it are one shared
|
||||||
// whichever section is active (each nav is a full page load in this
|
// accordion, not two independent ones, so expanding either closes
|
||||||
// multi-page admin, so there's no need to react to URL changes afterward).
|
// whichever else was open (including Aurora, previously the one
|
||||||
const openId = ref(props.menu.find((item) => isSectionActive(item))?.id ?? null);
|
// exception). AURORA_ID is a sentinel alongside the real native-menu item
|
||||||
|
// ids, since Aurora's own nav isn't one of the `menu` array's entries.
|
||||||
|
const AURORA_ID = '__aurora__';
|
||||||
|
|
||||||
|
const isAuroraSectionActive = () =>
|
||||||
|
props.auroraNav.some((item) => normalize(item.url) === current.value);
|
||||||
|
|
||||||
|
// Starts on whichever section is active (each nav is a full page load in
|
||||||
|
// this multi-page admin, so there's no need to react to URL changes
|
||||||
|
// afterward); falls back to Aurora expanded (its long-standing default)
|
||||||
|
// unless the user previously collapsed it, matching the old per-browser
|
||||||
|
// localStorage preference.
|
||||||
|
const openId = ref(
|
||||||
|
props.menu.find((item) => isSectionActive(item))?.id ??
|
||||||
|
(isAuroraSectionActive() || localStorage.getItem('aurora-nav-expanded') !== '0'
|
||||||
|
? AURORA_ID
|
||||||
|
: null)
|
||||||
|
);
|
||||||
|
|
||||||
const isExpanded = (item) => openId.value === item.id;
|
const isExpanded = (item) => openId.value === item.id;
|
||||||
|
|
||||||
@@ -75,13 +92,12 @@ const toggle = (item) => {
|
|||||||
openId.value = openId.value === item.id ? null : item.id;
|
openId.value = openId.value === item.id ? null : item.id;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Aurora's own branded nav section (Settings, Menu Creator, Admin Notices,
|
const auroraExpanded = computed(() => openId.value === AURORA_ID);
|
||||||
// Role Editor, Activity Log, Database Explorer) — separate from the
|
|
||||||
// WP-native menu list above it. Expanded by default; per-browser preference
|
|
||||||
// kept in localStorage, same pattern as the main collapsed-menu state.
|
|
||||||
const auroraExpanded = ref(localStorage.getItem('aurora-nav-expanded') !== '0');
|
|
||||||
const toggleAuroraNav = () => {
|
const toggleAuroraNav = () => {
|
||||||
auroraExpanded.value = !auroraExpanded.value;
|
openId.value = auroraExpanded.value ? null : AURORA_ID;
|
||||||
|
// Only Aurora's own expand state needs to persist across page loads —
|
||||||
|
// native sections already resolve their open/closed state from whether
|
||||||
|
// they're active on the current page.
|
||||||
localStorage.setItem('aurora-nav-expanded', auroraExpanded.value ? '1' : '0');
|
localStorage.setItem('aurora-nav-expanded', auroraExpanded.value ? '1' : '0');
|
||||||
};
|
};
|
||||||
const isAuroraActive = (item) => normalize(item.url) === current.value;
|
const isAuroraActive = (item) => normalize(item.url) === current.value;
|
||||||
|
|||||||
+2
-2
@@ -3,7 +3,7 @@
|
|||||||
* Plugin Name: Aurora Admin
|
* Plugin Name: Aurora Admin
|
||||||
* Plugin URI: https://aurora.co
|
* Plugin URI: https://aurora.co
|
||||||
* Description: A modern, fast WordPress admin interface.
|
* Description: A modern, fast WordPress admin interface.
|
||||||
* Version: 2.3.0
|
* Version: 2.3.1
|
||||||
* Author: Aurora
|
* Author: Aurora
|
||||||
* Text Domain: aurora-admin
|
* Text Domain: aurora-admin
|
||||||
* Domain Path: /languages/
|
* Domain Path: /languages/
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
defined("ABSPATH") || exit();
|
defined("ABSPATH") || exit();
|
||||||
|
|
||||||
define("AURORA_ADMIN_VERSION", "2.3.0");
|
define("AURORA_ADMIN_VERSION", "2.3.1");
|
||||||
define("AURORA_ADMIN_PATH", plugin_dir_path(__FILE__));
|
define("AURORA_ADMIN_PATH", plugin_dir_path(__FILE__));
|
||||||
define("AURORA_ADMIN_URL", plugins_url("aurora-admin/"));
|
define("AURORA_ADMIN_URL", plugins_url("aurora-admin/"));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user