Automattic / Automattic/jetpack
[Tiled Gallery] Shift+Click Selection in Reverse Order isn't working as expected
- 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:

### 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
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