[wp-trac] [WordPress Trac] #45186: Admin notice jumps from above the H1 to below it when created.

WordPress Trac noreply at wordpress.org
Sun Jun 5 10:56:32 UTC 2022


#45186: Admin notice jumps from above the H1 to below it when created.
----------------------------+---------------------------------
 Reporter:  dschalk         |       Owner:  (none)
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Administration  |     Version:  4.9.8
 Severity:  normal          |  Resolution:
 Keywords:  needs-patch     |     Focuses:  ui, administration
----------------------------+---------------------------------

Comment (by elpanda13@…):

 First of all, i'm sorry if the format is not the best, i'm new and not
 quite used to the standards here.



 I took a look at this issue and the real main problem is not that the
 notification is moved but that the notification is actually placed before
 the H1 tag in the first place (so the system is actually doing what is
 told).

 Here's where the code is first called in the one of settings page:
 https://github.com/WordPress/wordpress-
 develop/blob/78f451030b75a5c55c6cc1a4dae5b833ce9e003e/src/wp-admin
 /options-general.php#L52

 There are other settings page where the template is pretty much the same.


 The actual call that prints the notice is found here:
 https://github.com/WordPress/wordpress-
 develop/blob/78f451030b75a5c55c6cc1a4dae5b833ce9e003e/src/wp-admin/admin-
 header.php#L302-L304

 There might be a reason why the code is here (probably because it didn't
 require to modify the template's structure, maybe?) but it seems a bit out
 of place to me.

 I searched everywhere and unless i'm mistaken, it all points to options-
 head.php being used only for the settings page (and plugins maybe? this
 file seems to be used for back compatibility only, which got me confused
 as to why core is still using it?)

 At this point maybe we can fix it by requiring "options-head.php" directly
 below the H1 on each of the settings page, it seems harmless at this
 point.



 You can see a possible patch here:
 https://github.com/alejandrosan3/wordpress/commit/468bcce1a2a717374f0bfdfa673683870c9926d7

 If you can confirm it as a good solution, i can send a PR.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45186#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list