WordPress.org

Make WordPress Core

Opened 18 months ago

Closed 7 days ago

#36325 closed enhancement (wontfix)

Move #wpadminbar above #page

Reported by: wewlad Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4.2
Component: Toolbar Keywords:
Focuses: ui, administration Cc:

Description

Default position of #wpadminbar in your themes is at the top edge of the site, so if a site uses a style with fixed positions of some elements - the #wpadminbar might overflow them.
And because #wpadminbar goes after #page - you can't fix that with CSS, since there's no way to match an element based on sibling elements going AFTER it.
If you'd swap #wpadminbar and #page positions in HTML code - one could simply use '#wpadminbar~#page' selector then and change fixed positions for that case, so that #wpadminbar would never overlap any elements of the page.

Change History (6)

#1 @SergeyBiryukov
18 months ago

  • Component changed from Themes to Toolbar

Related: #30055

#2 follow-up: @cbutlerjr
13 months ago

  • Type changed from defect (bug) to enhancement

I can understand how this might be an issue. However, I'm not sure that moving this ID earlier in the stream is the best solution.

For starters, there's no requirement to place the toolbar at the top of the page. It can be positioned at the bottom, and that can be done with just CSS. Additionally, from a document perspective, I'm not sure I would agree that it makes much sense to have all of the toolbar HTML at the top of the document. That has the potential for an ugly page load in certain situations.

This isn't really a bug so much as it is an enhancement request.

#3 in reply to: ↑ 2 @danieltj
3 weeks ago

Replying to cbutlerjr:

I can understand how this might be an issue. However, I'm not sure that moving this ID earlier in the stream is the best solution.

For starters, there's no requirement to place the toolbar at the top of the page. It can be positioned at the bottom, and that can be done with just CSS. Additionally, from a document perspective, I'm not sure I would agree that it makes much sense to have all of the toolbar HTML at the top of the document. That has the potential for an ugly page load in certain situations.

This isn't really a bug so much as it is an enhancement request.

A setting or hook might be a better idea in terms of moving the toolbar but simply changing its position will mean that page of the page is loaded before the real content. I've also never had an issue with moving things around the toolbar because there's an .admin-bar class on the body tag so you can still style the cascade.

This ticket was mentioned in Slack in #core by danieltj. View the logs.


2 weeks ago

#5 @danieltj
2 weeks ago

  • Keywords close added

Suggesting this is closed because you can still control the cascade of these elements by using the .admin-bar class which is applied to the body tag when the admin toolbar is shown on the page.

edit...

Just to clarify, you can use:

body.admin-bar #page {
  background: red;
}
Last edited 2 weeks ago by danieltj (previous) (diff)

#6 @SergeyBiryukov
7 days ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

As noted above, it should be possible to adjust the styling as needed without changing the current markup.

Note: See TracTickets for help on using tickets.