ampproject / ampproject/amphtml

amp-timeago causes layout shift

Open
#27,229 4 comments 0 reactions 0 assignees View on GitHub
Related to: Performance Stale Type: Bug
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

## What's the issue?
amp-timeago causes layout shift, particularly when no default value is given, due to changing width of the element

## How do we reproduce the issue?
Use amp-timeago with layout="fixed-height"

Example:
https://www.livescience.com/amp/21312-freedom-of-the-press.html

## What browsers are affected?
all browsers

## Which AMP version is affected?
2003031842100

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with amp-timeago using layout="fixed-height" and the linked LiveScience example, then inspect the amp-timeago component implementation. Done means the element no longer causes layout shift when its value changes, including when no default value is provided, across the affected browsers.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
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.