Open Bug 301438 Opened 19 years ago Updated 2 years ago

While page is loading, scrolling to page id/named anchor not working when opened link inside document

Categories

(Core :: Layout, defect)

x86
Windows 2000
defect

Tracking

()

REOPENED

People

(Reporter: martijn.martijn, Unassigned)

References

()

Details

To reproduce, you probably need a not too fast internet connection.

- Open url
- While page is loading, click on the "9.3 Positioning schemes" link, for
instance. That page id/named anchor should not be available, yet.

When the page is done loading, the browser still doesn't scroll to the named
anchor. 
I would expect that to happen as soon as the page id/named anchor became available.

IE6 is doing this correct.
So... this is an interesting question.  If I click on an anchor and then a named anchor with that name is placed in the DOM via DOM methods, should we scroll to it?  Why is that case different from the parsing case, in general?

I can probably hack things so that if the document has a content sink we set the ref on the content sink, but is that really what we want?
IMHO we want to do this. The reason this is different during parsing is that it's just less surpricing for the page to scroll during loading when so many other things are still going on anyway.

But once the page is loaded and the user starts using it I think it would be very unexpected if we 'suddenly' scrolled to some new place. See also bug 301438.
OK.  So what do you think of my proposal?  The current control flow on a link click right now is that docshell explicitly scrolls presshell to anchor.  We'd have to get the document involved somehow so that it can pass the info on to the sink...
Sounds like an excellent solution. Once bug 103279 (which is the bug i ment to refer to above) is fixed it should integrate with that.
OK.  So I guess we need:

1)  A method on nsIDocument to set stuff on the sink
2)  A method on nsIContentSink
3)  Docshell code to let the document know

The docshell should probably still scroll the presshell...

Seems messy to me (in terms of docshell depending on various guts), but I don't really see a better solution.
If you're changing anchor scrolling, consider fixing (parts of) bug 103279 while you're there (see esp. bug 103279 comment 9 and bug 103279 comment 16).
Check the version of browser
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.