ampproject / ampproject/amphtml

amp-script container needs width or height

Open
#38,217 3 comments 0 reactions 0 assignees View on GitHub
Component: amp-script P3: When Possible Stale Type: Bug WG: components
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

### Description

On the playground samples the container layout of the amp-scripts doesn't have any height or width set, but works, why doesn't this work on my setup?

I use the exact same setup, but I get the error:

Skipped initializing amp-script due to zero width or height

I find it annoying that the documentation is not up2date on that matter or that the playground is not correct.

### Reproduction Steps

Look at the following playground, there is no mention of width or height on the amp-script and not even set the data-ampdevmode.

https://playground.amp.dev/?url=https%3A%2F%2Fpreview.amp.dev%2Fdocumentation%2Fexamples%2Fcomponents%2Famp-script%2F23&format=websites

### Relevant Logs

_No response_

### Browser(s) Affected

_No response_

### OS(s) Affected

_No response_

### Device(s) Affected

_No response_

### AMP Version Affected

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the linked AMP Playground example and the amp-script documentation it renders; compare the container sizing and data-ampdevmode guidance with the reported zero-size warning. Determine whether the example or documentation is incorrect, then verify the corrected example in a normal setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.