WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#17512 closed defect (bug) (fixed)

admin-bar CSS causing print problem

Reported by: hartley_h Owned by: westi
Milestone: 3.2 Priority: normal
Severity: normal Version: 3.1.2
Component: Administration Keywords: has-patch commit
Focuses: Cc:

Description

WP version 3.1.2

When I print blog entries, I sometimes find that portions of the last line on a page are split horizontally in half, with only the top half of the text showing up. The lower half is discarded. Other times, a complete line of text is omitted between one page and the next. This is true in all browsers, as far as I can tell but doesn't happen on all pages and of course changing the margin settings in the browser affects where it shows up, but not the fact of it showing up.

I traced the problem to two lines of CSS that are included in the wp-includes/admin-bar.php file. Specifically, if these two lines are commented out, the problem goes away (they are lines 311 and 312 in the 3.1.2 version of WordPress).

  html { margin-top: 28px !important; }
  * html body { margin-top: 28px !important; }

It seems like this could be fixed by modifying the line above them (line 310, the opening style tag) to specify that this rule only apply to screen layout. Since the admin-bar doesn't print in any case, I don't see any downside to this.

Change line 310 in wp-includes/admin-bar.php from:

<style type="text/css">

To:

<style type="text/css" media="screen">

Attachments (1)

17512.diff (425 bytes) - added by kawauso 3 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 nacin3 years ago

  • Milestone changed from Awaiting Review to 3.2

Yeah.

kawauso3 years ago

comment:2 kawauso3 years ago

  • Keywords has-patch added

comment:3 ocean903 years ago

  • Component changed from General to Administration

Fine for me.

comment:4 follow-up: nacin3 years ago

  • Keywords commit added

Anyone see an issue with screen being used as an implied implied "not print"? While there are other media types, I don't think we should have an issue -- but just checking.

We could also override our own CSS in the style media="print" that does the actual hiding of the admin bar.

comment:5 in reply to: ↑ 4 westi3 years ago

Replying to nacin:

Anyone see an issue with screen being used as an implied implied "not print"? While there are other media types, I don't think we should have an issue -- but just checking.

We could also override our own CSS in the style media="print" that does the actual hiding of the admin bar.

I think the patch on this ticket is probably the best solution.

comment:6 westi3 years ago

  • Owner set to westi
  • Resolution set to fixed
  • Status changed from new to closed

In [18088]:

Only apply the admin bar bump down css to the screen media type so it doesn't affect printouts. Fixes #17512 props kawauso.

Note: See TracTickets for help on using tickets.