RESOLVED FIXED 35547
Clicking the same named anchor twice in a row fails the second time
https://bugs.webkit.org/show_bug.cgi?id=35547
Summary Clicking the same named anchor twice in a row fails the second time
Nate Chapin
Reported 2010-03-01 14:45:58 PST
Originally reported at http://crbug.com/31851. Repro steps: 1. Go to http://en.wikipedia.org/wiki/WebKit 2. Click on "Usage" link in the Contents at the top of the page 3. Scroll back to top of the page 4. Click "Usage" again Step 4 should result in navigating back to the #Usage anchor, but nothing occurs. I believe this is a regression due to http://trac.webkit.org/changeset/51644. We don't scroll to the anchor if there isn't a hash change, which means we don't handle the case where we navigate, scroll, then navigate back to the same fragment. I have a fix and layout test ready and will upload momentarily.
Attachments
patch (3.78 KB, patch)
2010-03-01 14:51 PST, Nate Chapin
kenneth: review+
Nate Chapin
Comment 1 2010-03-01 14:51:56 PST
Kenneth Rohde Christiansen
Comment 2 2010-03-04 10:02:46 PST
Comment on attachment 49755 [details] patch > + // We need to scrool to the fragment whether or not a hash change occurred, since I guess that should be "scroll" :-) You should fix that before landing.
Nate Chapin
Comment 3 2010-03-04 16:47:39 PST
(In reply to comment #2) > (From update of attachment 49755 [details]) > > > + // We need to scrool to the fragment whether or not a hash change occurred, since > > I guess that should be "scroll" :-) You should fix that before landing. http://trac.webkit.org/changeset/55555
Brady Eidson
Comment 4 2010-03-04 17:13:33 PST
As far as I can tell, this change violates the HTML5 navigation spec: The section "Navigating to a fragment identifier" invokes "History traversal". History traversal has the following steps: 6 - If the specified entry has a URL that differs from the current entry's only by its fragment identifier, and the two share the same Document object, then let hash changed be true, and let old URL be the URL of the current entry and new URL be the URL of the specified entry. Otherwise, let hash changed be false. ... 8 - If hash changed is true, then, if the new URL has a fragment identifier, scroll to the fragment identifier. Since hashchange is false, there should be no scroll. --- All of that said, I think the new behavior is sensible, and it matches previous WebKit, Firefox, and Opera. But my original change wasn't an accidental change in behavior, it was willfully following the spec. I didn't realize at the time that it was breaking this fundamental case. I think the spec needs to be changed to reflect this, but until it is changed, WebKit (and other browser engines) are out of spec. :)
Brady Eidson
Comment 5 2010-03-04 17:31:50 PST
I brought this to Hixie's attention. He filed http://www.w3.org/Bugs/Public/show_bug.cgi?id=9193 to fix the spec. All is well.
Note You need to log in before you can comment on or make changes to this bug.