fix: Add exact flags to All orders/products/customers submenus
Submenu Active State Fix (Backend):
Problem: All orders/products/customers always showed active on detail pages
Root Cause: Backend navigation tree missing 'exact' flag for these items
- All orders at /orders matched /orders/123 (detail page)
- All products at /products matched /products/456 (detail page)
- All customers at /customers matched /customers/789 (detail page)
Solution: Added 'exact' => true flag to backend navigation tree
- Orders > All orders: path '/orders' with exact flag
- Products > All products: path '/products' with exact flag
- Customers > All customers: path '/customers' with exact flag
Frontend already handles exact flag correctly (previous commit)
Result: Submenu items now only active on index pages, not detail pages ✅
Files Modified:
- includes/Compat/NavigationRegistry.php (added exact flags)
- admin-spa/dist/app.js (rebuilt)
All submenu active state issues now resolved!
This commit is contained in:
@@ -127,7 +127,7 @@ class NavigationRegistry {
|
||||
'path' => '/orders',
|
||||
'icon' => 'receipt-text',
|
||||
'children' => [
|
||||
['label' => __('All orders', 'woonoow'), 'mode' => 'spa', 'path' => '/orders'],
|
||||
['label' => __('All orders', 'woonoow'), 'mode' => 'spa', 'path' => '/orders', 'exact' => true],
|
||||
['label' => __('New', 'woonoow'), 'mode' => 'spa', 'path' => '/orders/new'],
|
||||
// Future: Drafts, Recurring, etc.
|
||||
],
|
||||
@@ -138,7 +138,7 @@ class NavigationRegistry {
|
||||
'path' => '/products',
|
||||
'icon' => 'package',
|
||||
'children' => [
|
||||
['label' => __('All products', 'woonoow'), 'mode' => 'spa', 'path' => '/products'],
|
||||
['label' => __('All products', 'woonoow'), 'mode' => 'spa', 'path' => '/products', 'exact' => true],
|
||||
['label' => __('New', 'woonoow'), 'mode' => 'spa', 'path' => '/products/new'],
|
||||
['label' => __('Categories', 'woonoow'), 'mode' => 'spa', 'path' => '/products/categories'],
|
||||
['label' => __('Tags', 'woonoow'), 'mode' => 'spa', 'path' => '/products/tags'],
|
||||
@@ -151,7 +151,7 @@ class NavigationRegistry {
|
||||
'path' => '/customers',
|
||||
'icon' => 'users',
|
||||
'children' => [
|
||||
['label' => __('All customers', 'woonoow'), 'mode' => 'spa', 'path' => '/customers'],
|
||||
['label' => __('All customers', 'woonoow'), 'mode' => 'spa', 'path' => '/customers', 'exact' => true],
|
||||
['label' => __('New', 'woonoow'), 'mode' => 'spa', 'path' => '/customers/new'],
|
||||
],
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user