window.matchMedia('print') not called on window.print, but called on ctrl-p
Reported by
walker2...@gmail.com,
Jan 8
|
||||||
Issue description
UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
Steps to reproduce the problem:
1. attach an event handler on window.matchMedia('print')
2. call window.print
3. notice event doesnt fire
4. hit ctrl-p and notice event fires.
What is the expected behavior?
I expect both window.print and ctrl-p to both call the print handler.
What went wrong?
event didn't fire.
Did this work before? Yes 71.0.3578.80
Chrome version: 71.0.3578.98 Channel: stable
OS Version: 10.0
Flash Version:
working example of issue here
https://jsfiddle.net/p6vofhgc/1/
notice if you do ctrl-p, the event is fired (have to put focus in frame).
,
Jan 9
Tried testing the issue on reported chrome version #71.0.3578.98 using Windows 10 by following below steps. Steps: ===== 1.Launched chrome. 2.Navigated to https://jsfiddle.net/p6vofhgc/1/ observation : Able to see the print window Attached screencast for reference. @reporter: Could you please review above steps and let us know if anything is being missed here. Request you to retry the issue by creating a new person without any apps and extensions in it, reset all flags to default and let us know if issue still exists. Thanks.!
,
Jan 9
Your video showed the issue perfectly. The text should have been true in the print preview (it is if you ctrl - p). If the text says "not changed" then the event didnt fire. It should be true. Look at the javascript and what it is trying to do. The event should fire when it matches the print media and that would change the innerText to true. after print, the event should fire and the innertext should be changed to false. It works correctly if you do ctrl - p but not by the window.print(). Sorry, I didnt explain the test file better, I thought it was obvious was what it was doing.
,
Jan 9
Thank you for providing more feedback. Adding the requester to the cc list. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jan 10
I've seen this change in behaviour too.
I'd been using the MediaQueryList callback to measure and layout complex visualizations in a size appropriate for print. With Chrome 71.0.3578.98, the callback is not run until after the printing is done. With Chrome 69.0.3497.100 (the last version I have tested before that) the callback was run while the print preview dialog was open and could be used to lay out the visualizations for the page size.
As OP describes, this change has only affected window.print() - ctrl+p continues to function as before.
To try and summarise the order of events:
Before (and still the behaviour using ctrl+p instead of print):
window.print() --> onbeforeprint --> print dialog opens --> matchMedia('print') events fire --> user interacts & prints --> onafterprint
Now:
window.print() --> onbeforeprint --> print dialog opens --> user interacts & prints --> onafterprint --> matchMedia('print') events fire
This issue was first reported to me on January 3rd; afraid I have no better detail than that on when the change occurred.
,
Jan 10
[Reverse Bisect]Able to reproduce the issue on reported chrome 71.0.3578.98 however issue seems to be fixed in latest chrome canary 73.0.3666.0 using Mac 10.12, Windows 10 and Ubuntu 17.10 with steps mentioned in comment# 0,hence providing reverse bisect info Reverse Bisect Info: ================ Good build: 72.0.3626.20 Bad build: 72.0.3626.18 Change Log:https://chromium.googlesource.com/chromium/src/+log/72.0.3626.18..72.0.3626.20?pretty=fuller&n=10000 Suspecting:https://chromium.googlesource.com/chromium/src/+/966d79d7d453ca3c64b0f21384cba803174c602f Reviewed-on: https://chromium-review.googlesource.com/c/1375205 @Lei: Please confirm the issue and help in re-assigning if it is not related to your change Adding Release-Block-Stable as this is recent regression. Please feel free to remove if not applicable.
,
Jan 11
++ correction Status:Assigned
,
Jan 11
,
Jan 11
As merge to M-71 is already being requested in Issue 914554, hence merging there.
,
Jan 11
FYI, that bug is private.
,
Jan 12
Yes it is. The summary is the bug will be fixed in Chrome 72. You should be able to try out Chrome Beta or Chrome Canary and see the fix there. |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by phanindra.mandapaka@chromium.org
, Jan 8