amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

amp-story: Allow a viewer to request a page change from the story runtime

Open Pateriack opened this issue 7 years ago • 5 comments

Describe the new feature or change to an existing feature you'd like to see

Allow the viewer to request the amp story to go to the next or previous page using a new message type selectPage, based on the existing selectDocument type. Result of the message should be the same as if a user tapped on the story. Example API would be messaging.sendRequest('selectPage', { next: true }, false); to go to the next page and messaging.sendRequest('selectPage', { previous: true }, false); to go to the previous page.

Describe alternatives you've considered

No alternatives, this is not possible currently.

Additional context

Pateriack avatar Oct 28 '19 16:10 Pateriack

Our proposed solution is to name this message selectPage, similar to the selectDocument message. Is this an appropriate name? Are there any concerns with it overlapping any other existing names or extensions?

@gmajoulet

drtchops avatar Dec 13 '19 17:12 drtchops

We've been trying to find viewer messaging names that aren't prefixed with story so they can be re-used for regular AMP pages. However, selectPage might introduce confusion with the amp-next-page extension.

Do you all think selectPage is fine, or should we we prefix it selectStoryPage?

Additionally, we'd like to introduce the inverse messaging, that sends a message from the runtime to the viewer on page navigation. What would be a good name for this one? selectedStoryPage?

cc @erwinmombay @choumx for amp-next-page cc @ericfs

gmajoulet avatar Dec 13 '19 17:12 gmajoulet

From the viewer perspective, I don't see any issue with the name selectPage. If there is chance of conflict with amp-next-page then selectStoryPage sounds good. I don't see a problem with including story. selectedStoryPage also SGTM.

ericfs avatar Dec 13 '19 18:12 ericfs

selectPage sounds fine to me.

/cc @wassgha @jeffjose

dreamofabear avatar Dec 16 '19 19:12 dreamofabear

If we were to implement this for amp-next-page I think a more appropriate name would be scrollToPage so I think selectPage should be fine for amp-story but it doesn't hurt to prefix with story if there's no reason not to.

wassgha avatar Dec 16 '19 19:12 wassgha