HTML DOM scrollTop Property unsupported with printing device




2 years ago
2 years ago


(Reporter: C.Krueger.B, Unassigned, NeedInfo)


53 Branch

Firefox Tracking Flags

(Not tracked)



(1 attachment)



2 years ago
Created attachment 8862482 [details]

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0
Build ID: 20170418123315

Steps to reproduce:

I have partially visible contents in <div> tags, which are scrolled to specific locations. (I do so as a preparation step for printing out larger contents with controlled page breaks.)

Actual results:

The scrolling for the printing device is ignored. It always starts at the top position.

Expected results:

WYSIWYG: the scrolling of the screen should be taken over when using print media.
(Chromium 58.0 shows this IMHO correct behaviour.)

How to reproduce:
Open the attached file in Firefox and examine the difference between scrolling on screen and printer.


2 years ago
Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core


2 years ago
Component: DOM: Core & HTML → Printing: Output

Comment 1

2 years ago
Hmm,  I guess we could try to guess the scrolling position when cloning nodes for printing.
But it would be rather a guess only. Printing may affect to the layout quite a bit so whether the position is in right location isn't clear.

In practice the right solution is probably to modify the page in beforeprint event listener so that the expected layout can be achieved. (or perhaps some printing specific .css would work too)

Comment 2

2 years ago
FWIW, on linux using Chrome to print that page is all wrong. I don't see any text.

Comment 3

2 years ago
Do CSS specs define this kind of case at all?
Flags: needinfo?(dbaron)
You need to log in before you can comment on or make changes to this bug.