New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 699267 link

Starred by 8 users

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 1
Type: Bug

Blocking:
issue 624697



Sign in to add a comment

Anchor scroll to iframe when empty hash in parent URL

Reported by veevers....@gmail.com, Mar 7 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36

Steps to reproduce the problem:
1. Open file in Chrome and append an empty hash (#) to URL
2. Reload page
3. Browser will scroll jump to top of iframe

What is the expected behavior?
No scroll jump to iframe.

What went wrong?
Removing the style tag from the head of iframe document "solves" the issue. I'm guessing it's causing a reflow and jump-to-anchor logic is erroneously triggered at that point.

Few more notes:
- Does not happen when src set to a URL (but does happen when set to about:blank)
- Does not happen when hash in parent URL is not empty. "#foo" does not scroll, whereas "#" does.
- Works correctly in Firefox latest and Safari latest on Mac

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 56.0.2924.87  Channel: stable
OS Version: OS X 10.12.3
Flash Version: 

Maybe related issue: https://bugs.chromium.org/p/chromium/issues/detail?id=446756#

 
Labels: Needs-Triage-M56
Cc: hdodda@chromium.org
Labels: Needs-Feedback
Tested on Mac os 10.12.2 using chrome M56 #56.0.2924.87 and followed below steps :

1. Launched chrome and navigated to sample url given in  issue 446756  i.e.,http://img04.taobaocdn.com/tfscom/TB1_hhLHXXXXXXqXFXXO04pFXXX.html 
2. Appended # to the url end and reloaded the page
3. Page scroll jumps to the first ., observed same behavior in firefox and safari browsers too.

Attached screencast for reference.

@veevers.paul-- Could you please check attached screencast and confirm us if anything we missed from our side to reproduce the issue and also provide us the test url and expected result screencast , that would help us in traiging the issue better.

Thanks!
699267.mp4
1.0 MB View Download
Components: Blink>Scroll

Comment 4 by bokan@chromium.org, Mar 9 2017

NextAction: 2017-03-23
veevers.paul@gmail.com: Did you forget to attach a sample page? Also, when you say reload, do you mean pressing "Enter" with focus in the omnibox? Or actually clicking reload? (I assume the former since you added the hash)

Comment 5 by bokan@chromium.org, Mar 9 2017

Labels: -Pri-2 Pri-3
Also, unless it's a regression, reducing to normal priority.

Comment 6 by bokan@chromium.org, Mar 9 2017

Cc: bokan@chromium.org
Ah yes, very sorry I forgot the attachment. Here it is.

Thanks for the responses.
chrome-iframe-bug.html
763 bytes View Download
bokan@chromium.org: Either way seems to reproduce it.
Project Member

Comment 9 by sheriffbot@chromium.org, Mar 15 2017

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "hdodda@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Components: Blink>Layout
Labels: -Type-Bug -Pri-3 -Needs-Triage-M56 M-57 OS-Linux OS-Windows Pri-1 Type-Bug-Regression
Owner: hirosh...@chromium.org
Status: Assigned (was: Unconfirmed)
Able to reproduce the issue on Windows 10, mac 10.12.3 and Ubuntu 14.04 using chrome reported version #56.0.2924.87 and latest canary #59.0.3042.4.

Bisect Information:
=====================
Good build: 56.0.2913.0    Revision(430459)

Bad Build : 56.0.2914.0    Revision(430837)

Change Log URL: 
https://chromium.googlesource.com/chromium/src/+log/5db5553160affb9ea2464666320c3855e5d203d2..b8cb16f79a95c8bc639a9c58785a8484c197aca9

From the above change log suspecting below change

Review url: https://codereview.chromium.org/2269043002

hiroshige@ - Could you please check whether this is caused with respect to your change, if not please help us in assigning it to the right owner.

Thanks...!!

Comment 11 by e...@chromium.org, Mar 17 2017

Components: -Blink>Layout
Status: Started (was: Assigned)
Hmm. Looks like the scroll (unexpectedly) occurs if doc.write() is called after a certain point of time.

The <style> tag + https://codereview.chromium.org/2269043002 makes iframe's load event to occur a little later and thus causes the issue.
However, setTimeout() can also be used to delay doc.write() (see the attached test case).

chrome-iframe-bug-2.html
759 bytes View Download
Cc: -bokan@chromium.org hirosh...@chromium.org
Labels: -Type-Bug-Regression Type-Bug
Owner: bokan@chromium.org
Status: Assigned (was: Started)
Created a layout test: https://codereview.chromium.org/2797783002/
And the test fails even at r406082 on Linux.

I suspect this is not a recent regression: my CL just exposed an existing issue in scrolling.
bokan@, could you take a look?
Blocking: 624697
r266359 is also failing.
NextAction: ----
Thank you hiroshige@ for the analysis and test, that will help. I'll take a look - I'm guessing our scroll to fragment logic is being triggered incorrectly.
Labels: Hotlist-Input-Dev
Project Member

Comment 18 by bugdroid1@chromium.org, Apr 24 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/783d491b68d1b5833b65accba2e4fd595f09a404

commit 783d491b68d1b5833b65accba2e4fd595f09a404
Author: bokan <bokan@chromium.org>
Date: Mon Apr 24 21:21:39 2017

Clear hash when setting URL in document.open()

A document created via document.open()/write()/close() will have
as its URL the "responsible document" (see step #23 of
https://html.spec.whatwg.org/multipage/webappapis.html#dom-document-open)

This is a problem when the URL includes a fragment identifier, any
frame with a document.open from a document with a fragment will try
to scroll the iframe into view. I believe the intent in the spec was
not to include the hash.

BUG= 699267 

Review-Url: https://codereview.chromium.org/2801093002
Cr-Commit-Position: refs/heads/master@{#466770}

[add] https://crrev.com/783d491b68d1b5833b65accba2e4fd595f09a404/third_party/WebKit/LayoutTests/fast/scrolling/doc-write-to-iframe.html
[modify] https://crrev.com/783d491b68d1b5833b65accba2e4fd595f09a404/third_party/WebKit/Source/core/dom/Document.cpp

Comment 19 by bokan@chromium.org, Apr 25 2017

Labels: Merge-Request-59
Confirmed fix in Canary, this would be good to merge back to 59
Project Member

Comment 20 by sheriffbot@chromium.org, Apr 25 2017

Labels: -Merge-Request-59 Hotlist-Merge-Approved Merge-Approved-59
Your change meets the bar and is auto-approved for M59. Please go ahead and merge the CL to branch 3071 manually. Please contact milestone owner if you have questions.
Owners: amineer@(Android), cmasso@(iOS), gkihumba@(ChromeOS), Abdul Syed@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Project Member

Comment 21 by bugdroid1@chromium.org, Apr 26 2017

Labels: -merge-approved-59 merge-merged-3071
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6c3f14d345e3a04319074eced38eec423b8cd537

commit 6c3f14d345e3a04319074eced38eec423b8cd537
Author: David Bokan <bokan@chromium.org>
Date: Wed Apr 26 18:15:25 2017

Clear hash when setting URL in document.open()

A document created via document.open()/write()/close() will have
as its URL the "responsible document" (see step #23 of
https://html.spec.whatwg.org/multipage/webappapis.html#dom-document-open)

This is a problem when the URL includes a fragment identifier, any
frame with a document.open from a document with a fragment will try
to scroll the iframe into view. I believe the intent in the spec was
not to include the hash.

BUG= 699267 

Review-Url: https://codereview.chromium.org/2801093002
Cr-Commit-Position: refs/heads/master@{#466770}
(cherry picked from commit 783d491b68d1b5833b65accba2e4fd595f09a404)

Review-Url: https://codereview.chromium.org/2843763005 .
Cr-Commit-Position: refs/branch-heads/3071@{#232}
Cr-Branched-From: a106f0abbf69dad349d4aaf4bcc4f5d376dd2377-refs/heads/master@{#464641}

[add] https://crrev.com/6c3f14d345e3a04319074eced38eec423b8cd537/third_party/WebKit/LayoutTests/fast/scrolling/doc-write-to-iframe.html
[modify] https://crrev.com/6c3f14d345e3a04319074eced38eec423b8cd537/third_party/WebKit/Source/core/dom/Document.cpp

Comment 22 by bokan@chromium.org, Apr 26 2017

Status: Fixed (was: Assigned)
Labels: TE-Verified-M59 TE-Verified-59.0.3071.29
Verified this issue on Windows-10, Ubuntu 14.04 and Mac OS 10.12.4 using chrome latest beta M59 #59.0.3071.29 by following steps mentioned in the original comment using test case provided in the comment #7. Observed no scroll jump to iframe as expected. Hence adding TE-Verified label.
699267.ogv
854 KB View Download

Comment 24 by bokan@chromium.org, May 18 2017

Cc: skobes@chromium.org durga.behera@chromium.org ymalik@chromium.org rnimmagadda@chromium.org ajha@chromium.org kavvaru@chromium.org brajkumar@chromium.org
 Issue 596051  has been merged into this issue.

Sign in to add a comment