question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I2I: Introduce `PREVIEW` visibility state

See original GitHub issue

AMP PREVIEW visibility state

Overview

First step in enabling an auto-play preview mode for AMP stories, as described in https://github.com/ampproject/amphtml/issues/12815.

PREVIEW mode should default to PRERENDER mode in most cases, but must be privacy-preserving. This means any external resource loading must either happen through the serving domain (ex. via cache rewrite of <amp-video> target) or by delaying loading the component entirely if there’s no viable substitute (ex. <amp-analytics>).

Auto-play should be addressed separately while utilizing preview mode. This is to separate the set of preview-related concerns (primarily privacy and loading of external resources) from auto-play functionality (which may have more nuanced changes on how components function).

Approach

  1. Introduce PREVIEW visibility-state enum. Add previewAllowed method to BaseElement which defaults to returning prerenderAllowed. This change makes the PREVIEW visibility-state available and equivalent to PRERENDER.
  2. Update preact/base-element.js (prerenderAllowed), resource.js (prerenderAllowed), scheduler.js (maybeBuild), resource-impl.js (isLayoutAllowed_), and any remaining runtime+test files to handle new state.
  3. Return false from previewAllowed for any components which may load external resources, blocking them in preview for now; later, their implementation can be adjusted to handle preview specifically. Non-AMP tags such as <img> will require special handling (ex. cache rewrite) to avoid external resources, which will be the responsibility of the code/page presenting the story preview. An initial pass-through found the following tags requiring external loads, which should be initially disabled in preview:
    • <amp-analytics>
    • <amp-audio>
    • <amp-gist>
    • <amp-img>
    • <amp-install-serviceworker>
    • <amp-list>
    • <amp-live-list>
    • <amp-pixel>
    • <amp-story-360>
    • <amp-story-auto-analytics>
    • <amp-story-interactive-binary-poll>
    • <amp-story-interactive-poll>
    • <amp-story-interactive-quiz>
    • <amp-story-interactive-results>
    • <amp-story-panning-media>
    • <amp-twitter>
    • <amp-video>
    • <image>
    • <img>
    • <source>
    • <svg>
    • <track>
  4. Members of @wg-stories and @wg-components can separately prioritize updating the listed components to support preview visibility. This may include logic for visibility state changes from hidden --> preview --> prerender --> visible.

Milestones:

  • Introduce new visibility state and add previewAllowed to BaseElement
  • Update runtime code to handle new visibility state
  • Disable preview for external-loading tags/components
  • Expand preview support for listed components

These steps put us in a place where client code can start to display privacy-previews of stories, which a blocklist of unsupported elements.

@newmuis Does this all seem reasonable? It looks to be fairly straightforward, if I’m not missing too much.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
samouricommented, Jan 6, 2022

PREVIEW mode should default to PRERENDER mode in most cases, but must be privacy-preserving.

My understanding was that PRERENDER is currently privacy preserving.

0reactions
gmajouletcommented, Aug 5, 2022

Launched

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Story Preview] Allow all story pages and grid layers to be ...
In preview mode, all pages and grid layers must be rendered so that they can be seen in the SERP ... Part of...
Read more >
i2i_program_facilitator_guide_pri... - VetoViolence - CDC
i2i Ambassador Program and Events, and social and digital media. This chapter serves as an introduction to the Youth Communications.
Read more >
How to Use Visibility State Controls Within the Block Editor
Introduction. •. Scroll for details ... Autodesk AutoCAD - How to Use Visibility State Controls Within the Block Editor.
Read more >
Preview Visibility in Family Editor - YouTube
When you have too many options in your family(a lot of visibility parameters), this option will save you some time testing your family...
Read more >
You searched for Xcel Energy - Independence Institute
As it currently stands, California is the only state in the country allowed to establish their own vehicle emissions regulations, while other states...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found