-
Notifications
You must be signed in to change notification settings - Fork 815
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
Fix implementation of Infinite Scroll in AMP #17497
base: trunk
Are you sure you want to change the base?
Conversation
E2E results is available here (for debugging purposes): https://jetpack-e2e-dashboard.herokuapp.com/pr-17497 This is an automated check which relies on |
I think I determined what is wrong here, or at least the scenario that causes it to not work properly. I was testing with Twenty Nineteen and Twenty Twenty that was populated with the Theme Unit Test data. This means the footer widget areas were fully populated. The |
I tried to reproduce the issue on a standalone page but I was not able to. Even with a very tall footer that is 4x the viewport height it is loading as expected: https://amp-next-page-large-footer-test.glitch.me/long-footer-page-1.html |
I think I may actually have been at fault for misconfiguring Jetpack. I think I selected the “Load more posts in page with a button” option instead of “Load more posts as the reader scrolls down”. |
Squashing my 3 WIP commits into one. |
681177d
to
e649dab
Compare
@westonruter For me the next page starts to load after |
Another report of this being a problem: https://wordpress.org/support/topic/footer-text-in-last-line-of-footer/ |
Thank you, @westonruter, for the PR. I gave it a try and tested different possible scenarios, and in all, this is working great. The only issue I've found can be addressed by #17778, which I opened against this. Please, have a look at it. In the early stages of addressing this feature, we had an internal discussion about going with output buffers vs parsing the DOM. There was no strong argument, so we ended up going with the output buffers. However, I see no problem going with the parsed DOM. My other concern is about documentation around how themes can extend the Pending your review on that PR, I think this is in a good position to be merged. |
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.
I tested this PR and is working great.
@westonruter do you plan to keep improving this PR — as it is flagged as draft —, or it's good to move with the A8C review?
I don't plan to continue improving the PR, no. I was hoping to just get it started so that you or someone else could take the baton to the finish line. I don't have enough experience with the Infinite Scroll module to know everything that needs to be accounted for. |
Any update on this? Seems like the issue still hasn't fixed. |
Caution: This PR has changes that must be merged to WordPress.com |
As reported in Automattic/newspack-theme#1108 (comment) and Automattic/newspack-theme#1107, the AMP implementation of Infinite Scroll is broken in Jetpack. For example, as also reported on an AMP support forum topic, in the Twenty Seventeen theme the footer shows the text
%%footer%%
.The implementation appears to do more work than it needs to, by starting its own output buffering for the entire page when the AMP plugin is already doing this. Instead of doing search/replace on the output buffered document to make the necessary
changes, the better approach is to register an AMP plugin sanitizer which can make those changes on the DOM that is already being constructed from the output buffer by the AMP plugin.
This pull request is a start at fixing the implementation. I admit that I am not well-versed in Infinite Scroll or
amp-next-page
.The behavior currently in production for Twenty Twenty and Twenty Nineteen doesn't even seem to work as expected: I scroll down to the footer and then scroll back upward in order to start seeing the additional pages inserted.(This may have been due to not choosing the right setting for Infinite Scroll.)Changes proposed in this Pull Request:
%%footer%%
from showing up in themes that don't support Infinite Scroll.amp-next-page
in the DOM, rather than creating a secondary output buffer and perform brittle string replacements.Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
Proposed changelog entry for your changes: