-
Notifications
You must be signed in to change notification settings - Fork 42
autoload-visible should not trigger injection for page elements above visible page top #939
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
Comments
I felt this one coming ;) |
I see it's on @thet's name but I think it should be on my name. |
I don't see how you can fix this in markup. IMO it needs a javascript change on the line I quoted. |
@cornae does this need a definition phase? |
@cornae I'd like to work on that this evening. Can you give this feature a thought this afternoon? |
Yes. I'll IM you. |
tnx |
I'm off this afternoon and will check my mails/messages later |
First attempt to fix this issue: #941 The idea would be:
The canceling would be done by aborting the jquery ajax call or by sending an abortsignal for fetch. for that to work we would need access to the ajax request object and that would need a refactoring of pat-inject use patternslib base class and proper scoping/encapsulation. pat ajax would return the ajax request object and pat inject could store it on the pattern instance. work has begun here: #943 Instead the PR #941 uses an intersection observer and a window timeout to schedule the triggering which can be cleared if the element is moved out of the viewport. Status: the PR #941 needs more fine tuning and testing, currently it doesn't behave as it should. |
Patterns/src/pat/inject/inject.js
Line 1004 in 64fdb9a
Scenario: I have a document with 100 previews, each of which has a
trigger: autoload-visible
. It also has a comment sentinel with a page fragment url that takes me directly to the bottom of the page. Jumping to the bottom of the page should only trigger the injection of the last page preview image; pages 2-99 do not need to be loaded since they are in "flyover country".As a complication, when I then move away from this page via injection, this does not work, or rather it waits for a long time for all the 98 spurious preview injections to complete, before I can navigate away.
References:
The text was updated successfully, but these errors were encountered: