element-hq / element-hq/element-web

Images without metadata about their dimensions cause scroll jumps

Open
#22,222 0 comments 0 reactions 0 assignees View on GitHub
A-Media A-Timeline A-Timeline-Jumpy-Scroll O-Uncommon S-Minor T-Defect Z-Chronic
Dominant language
TypeScript
Stars
13.5k
Forks
2.8k
PR merge metrics
PR metrics pending

Description

### Steps to reproduce

1. Receive any image event that doesn't have size metadata (lacks an `info` field) (some bridges do this)
2. Watch it 'pop' into the timeline as it loads

### Outcome

#### What did you expect?

The tile should maintain a consistent size before and after loading to avoid scroll jumps. Element Android achieves this by giving the image an arbitrary constant height, though we could also consider somehow preloading the image before paginating the event into our ScrollPanel.

#### What happened instead?

Because there's no way to know what dimensions the image will have before loading, it causes a layout shift. If this happens in the scrollback of a room, it will cause scroll jumps when navigating through history.

### Operating system

NixOS unstable

### Browser information

Firefox 100.0

### URL for webapp

develop.element.io

### Application version

Element version: 6c87e294c4b2-react-fcc4d62edee7-js-f44510e65f9b Olm version: 3.2.8

### Homeserver

Synapse 1.58.0

### Will you send logs?

No

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.