Automattic / Automattic/jetpack

[Tiled Gallery] Shift+Click Selection in Reverse Order isn't working as expected

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

Description

### Quick summary

Expected is the keyword here, I am not sure if the current behavior is the intended behavior, but I'm seeing that people come to expect a different one.

When choosing images for a Tiled Galley Block, in the Media Gallery, When you shift+select a batch of media items from the end to the start, the order should remain End To Start, but that's not the case.
What happens is that if you want to Select 5 images with Shift+Click and start from the end, the expected order result should be: [ 5 ] [ 4 ] [ 3 ] [ 2 ] [ 1 ]
the current order result is: [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 1 ]

Here's a GIF of the bug:

![IncorrectOrderBugInMediaGallery - Copy](https://user-images.githubusercontent.com/1832078/162412496-bfe6e539-c825-4b82-bf3e-5da4c2741cff.gif)

### Steps to reproduce

Create a new post
Add Tiled Gallery Block
Select images and choose Media Library as source
Have 5 media items present
Shift+Select from old to new

### What you expected to happen

Correct order from older to newer,
or [ 5 ] [ 4 ] [ 3 ] [ 2 ] [ 1 ]

### What actually happened

Oldest is first, then order resets to newer to older.
Or: [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 1 ]

### Context

_No response_

### Simple, Atomic or both?

Simple, Atomic

### Theme-specific issue?

_No response_

### Browser, operating system and other notes

_No response_

### Reproducibility

Consistent

### Severity

All

### Available workarounds?

Yes, difficult to implement

### Workaround details

The workaround is manual selection.
This sounds fine until you have to select a couple of hundreds of media items.

Contributor guide

Open the contributing guide

Research direction

Start in the Tiled Gallery Block's Media Gallery flow and reproduce the consistent Shift+Click selection from old to new with five media items. Trace how the gallery records the selection order, then verify that reverse selection preserves [5] [4] [3] [2] [1] rather than producing [2] [3] [4] [5] [1].

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.