Skip to content
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

[amp-story-player] Support poster img from anchor el #33041

Merged
merged 1 commit into from Mar 5, 2021

Conversation

Enriqe
Copy link
Contributor

@Enriqe Enriqe commented Mar 3, 2021

Closes #30512

Now that #30753 has been merged, we can start supporting using an <img> tag to declare a poster image for the player.

@Enriqe Enriqe marked this pull request as ready for review March 3, 2021 20:11
@@ -386,10 +386,16 @@ export class AmpStoryPlayer {
initializeAnchorElStories_() {
const anchorEls = toArray(this.element_.querySelectorAll('a'));
anchorEls.forEach((element) => {
const posterImgEl = element.querySelector(
'img[data-amp-story-player-poster-img]'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't have the data- in the attribute right (looking at #30753)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should, we ended up bikeshedding on the name and changing it do data-* to make it comply with standard HTML spec.

You can verify by looking at the AMP version validator

name: "data-amp-story-player-poster-img"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ok, I had a feeling that data attributes should have a value (not just the empty string) but the documentation seems to be vague on this. LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Story Player: Consider use of child img for poster instead of custom style property
3 participants