✨ InaboxResources: Observe intersections for some elements' viewportCallbacks#26942
✨ InaboxResources: Observe intersections for some elements' viewportCallbacks#26942alanorozco merged 7 commits intoampproject:masterfrom
Conversation
lannka
left a comment
There was a problem hiding this comment.
I like it. @dvoytenko I think we talked a bit about this. do you think we should do something like this for all AMP extensions? maybe an InOb service.
|
My one question: does carousel need a Yeah, if we did something like this, we should look into how to do this higher up for other elements as well. But I do think the elements have to opt-in. |
|
@dvoytenko It's to start/pause autoplay. The actual signal here is visibility, so I'm unsure what a better model would be. |
Got it. We need do something like this. But it looks like for now it's only needed in inabox? Can we use some API separation for inabox to limit this for now? |
|
@dvoytenko RE: siloing to inabox, should we try to get rid of This would also remove the need for a scroll-bound event handler on video, and help with embedding video components and |
If we talk about the future: absolutely, I'd like to get rid of the
|
It sounds like we can make the opt-in API here similar to the
Fair, I believe this PR still leaves the opportunity for that to be solved in the future. FWIW, IE is left out from this workaround. Let me know if I'm missing something about making this specific to inabox at the moment. |
jridgewell
left a comment
There was a problem hiding this comment.
I think just adding viewportCallback support in inabox is easier here, then we can migrate the entire API to InOb later.
|
Discussed offline with @dvoytenko and @jridgewell. We're special-casing some component types on @lannka @dvoytenko @jridgewell PTAL, ready for review. |
* master: (54 commits) inabox-resources: Minor test improvement (ampproject#26916) DocInfo: replace metaTags with viewport in API (ampproject#26687) 🐛 SwG now uses AMP sendBeacon interface (ampproject#26970) 🏗 Allow array destructuring on preact hooks (ampproject#26901) Gulp Dep Check: fail on unused entries (ampproject#26981) Update no-import lint rule to forbid sub-paths (ampproject#26531) 🐛 amp-ad type blade - fix bladeOnLoad callback (ampproject#26627) 📖 Clarify when max-age is required (ampproject#26956) ♻️ Consolidate players as .i-amphtml-media-component (ampproject#26967) Add Preact Enzyme tests (ampproject#26529) Fixes `update_tests` flag on `gulp validator` (ampproject#26965) 📦 Update dependency google-closure-library to v20200224 (ampproject#26986) 🏗 Transform aliased configured components (ampproject#26541) ✨ InaboxResources: Observe intersections for some elements' viewportCallbacks (ampproject#26942) variable substitutions: Support allowlist lookup in AmpDocShadow (ampproject#26731) cl/297197875 Revision bump for ampproject#26877 (ampproject#26982) Json fix (ampproject#26971) 📦 Update dependency mocha to v7.1.0 (ampproject#26976) Add documentation for amp-access-scroll (ampproject#26782) make controls always shown in amp for email (ampproject#25714) ...
viewportCallbackis not triggered fromInaboxResources. For browsers that supportIntersectionObserver, use that instead to trigger them.