Skip to content

Commit 1d4c25a

Browse files
Fix: Render notices after page actions if present (#14)
1 parent 5c1302f commit 1d4c25a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.github/workflows/tests-php.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
id: get-composer-cache-dir
3232
run: |
3333
echo "::set-output name=dir::$(composer config cache-files-dir)"
34-
- uses: actions/cache@v2
34+
- uses: actions/cache@v4
3535
id: composer-cache
3636
with:
3737
path: ${{ steps.get-composer-cache-dir.outputs.dir }}

src/resources/admin-notices.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,15 @@
6868
const location = $notice.data(locationAttribute);
6969

7070
if (location === 'below_header') {
71+
// Place notice after the page action element (e.g., "Add Plugin" on the Plugins page) if it exists;
72+
// otherwise, insert it after the <h1>. On some pages, placing the notice directly after the <h1>
73+
// can cause it to appear between the header and its action button, leading to layout issues.
74+
const $pageTitleAction = $('a.page-title-action');
75+
if ($pageTitleAction.length) {
76+
$notice.insertAfter($pageTitleAction);
77+
} else {
7178
$notice.insertAfter('h1');
79+
}
7280
} else if (location === 'above_header') {
7381
$notice.insertBefore('h1');
7482
} else if (location === 'inline') {

0 commit comments

Comments
 (0)