[wp-trac] [WordPress Trac] #42300: Admin Bar CSS assumes body is not positioned

WordPress Trac noreply at wordpress.org
Tue Dec 10 06:19:45 UTC 2024


#42300: Admin Bar CSS assumes body is not positioned
--------------------------+-----------------------------
 Reporter:  joyously      |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Future Release
Component:  Toolbar       |     Version:  4.5.7
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:  css
--------------------------+-----------------------------

Comment (by aaylasecura):

 Apologies for opening a duplicate ticket, I did not find this thread
 initially.

 I'll post my alternative suggestions here then. I hope this ticket is
 revived and some progress is made.

 In addition to the suggested padding on body, I can think of two
 alternative approaches that result in the same admin bar behaviour that
 work regardless of the position type of body/html.

 Option 1 (depends on sticky position which is not supported in IE):
 - put the admin bar as the first child of body
 - admin bar is sticky on wide screens, relative on narrow

 Option 2 (supported even on very old browsers):
 - insert a dummy element as the first child of body with the same height
 as admin bar
 - admin bar is fixed on wide screen, absolute on narrow

 Option 1 demo: https://jsfiddle.net/oxfhk392/

 Option 2 demo: https://jsfiddle.net/4rn51mbf/

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


More information about the wp-trac mailing list