Automattic / Automattic/jetpack

Tiled Gallery doesn't reset column width attribute when switching layouts

Open
#22,225 0 comments 0 reactions 0 assignees View on GitHub
[Block] Tiled Gallery [Feature] Tiled Gallery [Plugin] Jetpack [Pri] Low Bug Triaged
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

### Impacted plugin

Jetpack

### Steps to Reproduce

1. Insert a Tiled Gallery block
2. Add a couple of images
3. Change the block's style from default Mosaic to Square layout
4. Switch to the code editor (Settings Sidebar → Ellipsis menu → "Code editor")
5. Notice the block attribute `columnWidths` is present, even though it's not used (to my knowledge) by the Square layout

### A clear and concise description of what you expected to happen.

I expected the `columnWidths` attribute to **not** be present for the Square layout.

### What actually happened

I found the `columnWidths` attribute is still present in the block's HTML representation of the Square layout.

### Other information

My understanding is that `columnWidths` represents column widths percentages of the Tiled mosaic layout, so it has no meaning in the square layout.

The square layout positions images in columns according to the user's chosen number of columns. Any "overflow" (the remainder of total images modulus column count) are added to a new row at the top of the layout.

### Operating System

macOS

### OS Version

macOS 12.1 Catalina

### Browser

Firefox

### Browser Version(s)

95.0.2

Contributor guide

Open the contributing guide

Research direction

Start with the Tiled Gallery block's layout-switching and serialized attribute handling, then reproduce the Mosaic-to-Square steps and inspect the block in the code editor. Done means switching to Square removes the unused columnWidths attribute while preserving the selected layout and images.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.