getBoundingClientRect returns wrong values after resizing page.
Reported by
jshan...@etouch.net,
Nov 21 2016
|
||||||||||
Issue descriptionChrome Version: 57.0.2926.0 (Official Build) da59d418f54604ba2451cd0ef3a9cd42c05ca530-refs/heads/master@{#433437}-32/64 bit OS:Windows(7,8,8.1,10),Linux (14.04 LTS),Mac OS X(10.11.6, 10.12.1) What steps will reproduce the problem? (1)Launch chrome and navigate to chrome://md-settings/ (2)Click on "open a specific page.." radio button , click on 'use current pages' button. (3)Click on iron icon and click anywhere on page such that list closes. (4)Now click on'restore down' button, resize window from R.H.S and again click on same iron icon observe. Actual: Focus issue observed after clicking on iron icon if browser window is resized. Expected: Focus should not disappear after clicking on iron icon (i.e after step 4) This is a regression issue broken in 'M56' and below is the manual regression range: Good Build: 56.0.2900.0 Bad Build: 56.0.2901.4
,
Nov 21 2016
The problem is not the focus. The problem is that the menu opens at a random place the 2nd time you click, instead of opening close to the anchor element. Attaching a screencast showing the problem. Repro (see video) 1) Open and close action menu once, see correct bounding client rect values being printed. 2) Decrease the width of the window. 3) Open action menu again, Menu is shown at a random location, and getBoundingClientRect values are wrong (especially the 'left' value). 4) Close and re-open, menu shows up at the correct location. FYI, this is the 2nd getBoundingClientRect bug that affects cr-action-menu, perhaps they are related (https://bugs.chromium.org/p/chromium/issues/detail?id=662300).
,
Nov 21 2016
,
Nov 22 2016
a puppy dies every time getBoundingClientRect() returned a mistakenly cached value
,
Nov 28 2016
Just for update,Still able to reproduce the issue on Mac 10.11.6 using latest chrome version 57.0.2935.0. Could anyone please look into this issue. Thanks!
,
Jan 5 2017
Issue 678176 has been merged into this issue.
,
Jan 6 2017
FWIW, this is now reproducible in the History page without any runtime flags enabled.
,
Jan 6 2017
We'd need some kind of reduction to diagnose if getBoundingClient rect was returning the wrong values. Sending to eae@ for layout team triage.
,
Jan 6 2017
There are no blink changes in the regression range and I have not been able to reproduce this on any platform (win, mac, linux, chromeos). If you think this is a problem with getBoundingClientRect a reduction would be incredibly helpful.
,
Jan 6 2017
Stepping through with Devtools reveals the problem is in cr-action-menu: When showModal() is called, the dialog immediately reappears at the position it was in previously. If the window has been resized horizontally, the dialog can appear offscreen to the right, messing up the position calculations. Resetting the left/top values before reshowing the dialog fixes the issue.
,
Jan 6 2017
@tsergeant: Per my own debugging at comment#2 (see video), the this.anchorElement_.getBoundingClientRect() call returns wrong values (clearly shown in the video 27s, where left is incorrectly 194.45px, unless I am mistaken). How is this affected by the previous values of this.style.left/right/top? Even if they where initially messing up the dialog's position, shouldn't the position be corrected by the logic after showModal() (https://cs.chromium.org/chromium/src/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js?l=135-151)?
,
Jan 7 2017
,
Jan 8 2017
#11: Based on what you can see in the video, it does -look- like getBoundingClientRect() returns the wrong values. However, putting a breakpoint immediately after the call to showModal() shows what's actually happening (screenshots attached, since it's hard to explain in words). First, the menu reappears using the same top/left values as last time it was shown. This scrolls the window to the right, and so at the point that getBoundingClientRect() is called, the menu button is positioned left of where it would normally appear. Since getBoundingClientRect is relative to the viewport, this position is reflected in the rect that is returned. cr-action-menu then does the calculations based on that (incorrect) position, and changes its top/left position. This then causes the scroll pane to disappear and the menu button to return to its original position. Resetting top/left/right prevents that scroll pane from appearing, and so the menu button never moves.
,
Jan 12 2017
Thanks for the explanation. The sneaky scrolling of the viewport is what I was missing to understand how resetting previous this.style.left/right/top would fix the issue.
,
Jan 13 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/b1caf20ec92bdf673b7b86adfca7e5121914551a commit b1caf20ec92bdf673b7b86adfca7e5121914551a Author: tsergeant <tsergeant@chromium.org> Date: Fri Jan 13 01:20:20 2017 MD WebUI: Fix incorrect positioning of action menu after window resize Showing the menu, resizing the browser window horizontally and then showing the menu a second time could result in incorrectly positioning the window, as position values from the first instance would affect layout of the second instance. This fixes the issue by clearing position alues before reshowing the menu. BUG= 667198 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation Review-Url: https://codereview.chromium.org/2614663011 Cr-Commit-Position: refs/heads/master@{#443429} [modify] https://crrev.com/b1caf20ec92bdf673b7b86adfca7e5121914551a/chrome/browser/resources/md_history/lazy_load.crisper.js [modify] https://crrev.com/b1caf20ec92bdf673b7b86adfca7e5121914551a/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js
,
Jan 15 2017
|
||||||||||
►
Sign in to add a comment |
||||||||||
Comment 1 by jshan...@etouch.net
, Nov 21 2016Owner: dpa...@chromium.org
Status: Assigned (was: Unconfirmed)