Fix Admin Notices not showing on the Dashboard (v2.4.2)
admin_notices fires everywhere, but prints inside #wpbody, which DashboardTakeover hides entirely on the Dashboard (to hide the *native* dashboard, not ours) — notices went down with it as collateral damage. Notices::render_for_dashboard() now renders directly inside the visible dashboard frame instead, called from DashboardTakeover::render_mount(); the normal admin_notices path bails on the Dashboard so it isn't rendered twice. Second, independent bug found along the way: wp-admin/js/common.js unconditionally relocates every .notice element on the page to right after the page's <h1>, regardless of where it was placed server-side — without opting out, it would've silently moved our notice right back into the hidden #wpbody. Used core's own documented `below-h2` class to opt out, only for the dashboard render path. Verified live: notice now shows correctly inside the dashboard frame with proper dark styling, and dismisses correctly. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
03c3c4fc89
commit
d8bf1ae049
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "aurora-admin-app",
|
||||
"version": "2.4.1",
|
||||
"version": "2.4.2",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -376,6 +376,21 @@ html.aurora-has-taskbar #site-editor {
|
||||
border-top-right-radius: var(--aurora-radius-lg);
|
||||
}
|
||||
|
||||
/* Custom admin notices (Notices::render_for_dashboard(), reparented in
|
||||
here by windowChrome.js) — native-dark.css already themes .notice
|
||||
elsewhere via #wpbody-content, but that stylesheet isn't loaded on the
|
||||
Dashboard at all (Shell::is_own_page() treats index.php as one of
|
||||
Aurora's own pages), so it needs its own copy of the same treatment
|
||||
here instead. */
|
||||
#aurora-admin-dashboard-notices:empty {
|
||||
display: none;
|
||||
}
|
||||
#aurora-admin-dashboard-notices .notice {
|
||||
background: var(--aurora-card-bg);
|
||||
color: var(--aurora-text);
|
||||
margin: 16px 20px 0;
|
||||
}
|
||||
|
||||
/* Yellow dot: on the Dashboard itself there's nowhere further "home" to
|
||||
send it, so minimize just collapses the frame down to the title bar in
|
||||
place — everywhere else, minimize navigates to the dashboard instead
|
||||
|
||||
@@ -87,6 +87,15 @@ export function initWindowChrome(adminUrl) {
|
||||
frame.className = 'aurora-dashboard-frame';
|
||||
dashboardRoot.parentNode.insertBefore(frame, dashboardRoot);
|
||||
frame.appendChild(bar);
|
||||
// Custom admin notices (Notices::render_for_dashboard(), printed as a
|
||||
// sibling right before the mount point) — reparented into the frame
|
||||
// here too, so they render as part of the dashboard's own card
|
||||
// instead of sitting outside it unstyled. Normally these reach the
|
||||
// user via the plain admin_notices hook, but that renders inside
|
||||
// #wpbody, which the Dashboard hides entirely to hide the *native*
|
||||
// dashboard widgets — this is the replacement path for that one page.
|
||||
const notices = document.getElementById('aurora-admin-dashboard-notices');
|
||||
if (notices) frame.appendChild(notices);
|
||||
frame.appendChild(dashboardRoot);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user