-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update the URL when a fragment link to that navigates the current doc is clicked #1461
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -645,7 +645,12 @@ export class ViewportBindingNatural_ { | |
if (doc./*OK*/scrollingElement) { | ||
return doc./*OK*/scrollingElement; | ||
} | ||
if (doc.body) { | ||
if (doc.body | ||
// Firefox does not support scrollTop on doc.body for default | ||
// scrolling. | ||
// See https://github.com/ampproject/amphtml/issues/1398 | ||
// Unfortunately there is no way to feature detect this. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't you scroll, and see if the scrolled? const scrollTop = doc.body.scrollTop;
doc.body.scrollTop = 1;
const scrolled = doc.body.scrollTop === 1;
doc.body.scrollTop = scrollTop; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jridgewell we don't do feature testing if the feature testing would force layout or style recalc. I'm also not sure that would actually work :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It'd certainly not work if the document is not presently scrollable (i.e. too short). |
||
&& !platform.isFirefox()) { | ||
return doc.body; | ||
} | ||
return doc.documentElement; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this is correct? There are still lots of chromes out there with the old API...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may need to check the platform here - I looked around. This will definitely cause many problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.