Page MenuHomePhabricator

Image Browsing: Build out responsive / large screen behavior
Closed, ResolvedPublic5 Estimated Story Points

Assigned To
Authored By
egardner
Aug 26 2025, 7:00 PM
Referenced Files
F66023610: screenshot 153.png
Sep 15 2025, 4:00 PM
F66023607: screenshot 152.png
Sep 15 2025, 4:00 PM
F66023604: screenshot 151.png
Sep 15 2025, 4:00 PM
F66023602: screenshot 150.png
Sep 15 2025, 4:00 PM
F66023600: screenshot 149.png
Sep 15 2025, 4:00 PM
F66015670: Morocco_2-col-grid.gif
Sep 12 2025, 2:26 AM
F66015445: Morocco_2-column-grid.png
Sep 12 2025, 2:26 AM
F65948765: image.png
Sep 2 2025, 2:08 PM

Description

Background

We are primarily concerned with mobile user behavior for our Image Browsing prototype. However, we think it makes sense to build a responsive UI from the get-go here (in part because MediaWiki makes it hard to truly segregate "mobile" and "desktop" users – skin selection and mobile domain usage don't necessarily guarantee anything about device or viewport in our ecosystem).

Note: @JScherer-WMF will populate this ticket with some screenshots to illustrate the intended behavior alongside the descriptions here.

Small screen behavior

We should think of our UI in "mobile first" terms. So small screen behavior is the default, and additional behavior will be introduced at larger viewport sizes.

On small screens / by default, users will see the following:

  • The DetailView component will fill the entire viewport when active. The user will see a full-bleed image that is centered on whatever we believe to be the most relevant part of the image (per T402203). Images will fill the entire height of this area.
  • The Visual Table of Contents component will be immediately below the DetailView component, visible on scroll. Within the Visual Table of Contents, every VTOC Item component will be stacked in a single column. Images within the VTOC items will have a height of 300px or less. Images inside VTOC items should be shown in their entirety (don't crop them), and they should be centered.
Large(r) screen behavior
  • When viewport width exceeds 640px, the Visual Table of Contents will switch to a 2-column layout. One thing to note about this layout – there will be two columns or "tracks", and VTOC items will be placed in alternating tracks in the order they occur within the page, but they will not have fixed heights within these tracks. Height will instead be determined by the amount of text content. Image height restrictions will not change from the mobile styles above. We will probably need to use CSS Grid to create this "masonry" style layout, and may need a dedicated task for that work.

Screenshot 2025-09-02 at 9.45.25 AM.png (1×560 px, 1 MB)

  • When viewport width exceeds 1000px (the same as the max content container size on Minerva), both the DetailView and Visual Table of Contents components will stop expanding; instead a backdrop element will be visible in any additional space to the left and right edges.
  • Images within the DetailView will still crop based on subject detection, but the exact dimensions be: 1000px wide x 100vh tall (there is no margin at the top or bottom). Images will fill the entire height of this area and will be cropped arbitrarily.

Screenshot 2025-09-02 at 9.47.28 AM.png (1×1 px, 3 MB)

Implementation considerations
  • None of this behavior is skin-dependent (unless we want to use a different max-width on Vector vs Minerva to match the skin-specific container widths?)
  • Would user font-size preference or Codex font mode impact any of these values? not clear
  • We are not hiding the UI from desktop browsers
QA process
  • This patchdemo instance can be used: https://patchdemo.wmcloud.org/wikis/7b60cdc924/wiki/Berlin
  • Visit a few well-illustrated articles on that wiki (I've been going to pages for major cities, which typically have lots of different types of photos included).
  • View the feature desktop and mobile viewport sizes (or real devices)
  • Try different skins, text sizes, etc (may need to log in for that)
  • Make note of any weird design or layout issues here in the comments

(You can disregard the lack of loading states for now, that will be handled in T402973).

Requirement

Build responsive UI behavior for Image Browsing that adapts to different viewport sizes while maintaining a mobile-first approach. On small screens, the DetailView must fill the viewport and the Visual Table of Contents (VTOC) must render in a single column with uncropped images ≤300px tall. On viewports wider than 640px, the VTOC must render in a 2-column alternating "masonry" layout. On viewports wider than 1000px, the DetailView and VTOC must max out at 1000px width with backdrop padding on the sides. Cropping behavior, image height rules, and alignment must remain consistent with these specifications.

BDD

Feature: Responsive layout for Image Browsing components

  Scenario: Small screen layout
    Given the viewport width is ≤640px
    When an article with images is loaded
    Then the DetailView fills the viewport height with a full-bleed image cropped based on subject detection
    And the VTOC appears below the DetailView in a single column
    And VTOC images are centered, fully visible, and ≤300px in height

  Scenario: Medium screen layout
    Given the viewport width is >640px and ≤1000px
    When an article with images is loaded
    Then the VTOC renders in a 2-column alternating masonry layout
    And VTOC image height remains ≤300px

  Scenario: Large screen layout
    Given the viewport width is >1000px
    When an article with images is loaded
    Then the DetailView and VTOC stop expanding beyond 1000px width
    And a backdrop element fills extra space on left and right
    And the DetailView image is 1000px wide x 100vh tall, filling the area with cropping as needed

Test Steps

Test Case 1: Verify small screen layout (≤640px)

  1. Open https://patchdemo.wmcloud.org/wikis/7b60cdc924/wiki/Berlin
  2. Resize viewport to ≤640px width
  3. AC1: DetailView image fills viewport height with subject-detection cropping
  4. AC2: VTOC is rendered directly below DetailView in a single column
  5. AC3: VTOC images are fully visible, centered, and have height ≤300px

Test Case 2: Verify medium screen layout (>640px ≤1000px)

  1. Resize viewport width to between 641px and 1000px
  2. AC4: VTOC renders in a 2-column alternating masonry layout
  3. AC5: VTOC images remain centered, fully visible, and height ≤300px

Test Case 3: Verify large screen layout (>1000px)

  1. Resize viewport width to >1000px
  2. AC6: DetailView and VTOC max out at 1000px width
  3. AC7: Backdrop element fills extra space on both sides
  4. AC8: DetailView image is constrained to 1000px width x 100vh height and cropped arbitrarily as needed

https://phabricator.wikimedia.org/T402964#11181553

QA Results - Patchdemo

Event Timeline

I had a little confusion reading the 2-column layout description :D But double-checking with Eric confirmed we do mean the "masonry" style, with items filled in as they go.

Not a super fan of the vertical masonry style myself, but it will look pretty -- if we wanna go that way, old-school float/clear logic should work but CSS Grid should be the modern way to do it.

I had a little confusion reading the 2-column layout description :D But double-checking with Eric confirmed we do mean the "masonry" style, with items filled in as they go.

Not a super fan of the vertical masonry style myself, but it will look pretty -- if we wanna go that way, old-school float/clear logic should work but CSS Grid should be the modern way to do it.

Masonry style here basically means "2 column Pinterest board layout". We are explicitly OK with varying heights – even if a bunch of long items in one column push things down where you start to see the images a bit out of order. These elements are meant to invite the viewer to browse across different parts of the page, so we can be a little loose here.

they will not have fixed heights within these tracks. Height will instead be determined by the amount of text content.

I'm concerned about this, but maybe I just need a visual of some items with long content. If we expand and collapse the content like it's done in DetailView, then that may cause a lot of movement and tiles bumping each other for space. IDK

ovasileva triaged this task as Medium priority.Aug 27 2025, 5:03 PM
ovasileva set the point value for this task to 5.
ovasileva moved this task from Needs Refinement to Ready on the Reader Growth Team board.

they will not have fixed heights within these tracks. Height will instead be determined by the amount of text content.

I'm concerned about this, but maybe I just need a visual of some items with long content. If we expand and collapse the content like it's done in DetailView, then that may cause a lot of movement and tiles bumping each other for space. IDK

This is a super valid concern. We should probably add a x-lines then truncate rule to the vToC text. This is a bit arbitrary, but what do you all think of capping the height of the caption text box at 300px then truncate the text. 300px is the same max height as the images.

This is what the vtoc looks like at 640 width with large font size, for example...

image.png (4×1 px, 2 MB)

This is with the max 300px rule:

image.png (3×1 px, 2 MB)

I'm not too worried about the text there getting truncated because there's a view in article button right there and people can view the full text really easily.

Change #1184965 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[mediawiki/extensions/ReaderExperiments@master] [WIP] Image Browsing: VTOC masonry layout

https://gerrit.wikimedia.org/r/1184965

Change #1185217 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[mediawiki/extensions/ReaderExperiments@master] ImageBrowsing: Add overlay backdrop element and large-screen sizes

https://gerrit.wikimedia.org/r/1185217

Change #1184965 merged by jenkins-bot:

[mediawiki/extensions/ReaderExperiments@master] Image Browsing: VTOC masonry layout

https://gerrit.wikimedia.org/r/1184965

Change #1185217 merged by jenkins-bot:

[mediawiki/extensions/ReaderExperiments@master] ImageBrowsing: Add overlay backdrop element and large-screen sizes

https://gerrit.wikimedia.org/r/1185217

Change #1186499 had a related patch set uploaded (by Matthias Mullie; author: Matthias Mullie):

[mediawiki/extensions/ReaderExperiments@master] Disable body scroll when overlay is open

https://gerrit.wikimedia.org/r/1186499

Change #1186499 merged by jenkins-bot:

[mediawiki/extensions/ReaderExperiments@master] Disable body scroll when overlay is open

https://gerrit.wikimedia.org/r/1186499

I noticed in the Morocco article (patchdemo) that the borders at the end of the 2-column grid were incomplete. We currently set border-right and border-bottom to the VTOC items. Resizing the screen, you'll notice that the grid looks complete or incomplete at different breakpoints. It would be nice to use something similar to the border-collapse CSS property, but that's intended for table elements. Any suggestions to improve this?

screenshot:

Morocco_2-column-grid.png (1×2 px, 1 MB)

screen recording:

Morocco_2-col-grid.gif (324×480 px, 3 MB)

I noticed in the Morocco article (patchdemo) that the borders at the end of the 2-column grid were incomplete. We currently set border-right and border-bottom to the VTOC items. Resizing the screen, you'll notice that the grid looks complete or incomplete at different breakpoints. It would be nice to use something similar to the border-collapse CSS property, but that's intended for table elements. Any suggestions to improve this?

Morocco_2-column-grid.png (1×2 px, 1 MB)

Morocco_2-col-grid.gif (324×480 px, 3 MB)

@lwatson you're right, this needs a tiny bit of additional CSS finessing.

I don't know about any border-collapse equivalent here but we may need special rules for the last child at least.

Change #1187873 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[mediawiki/extensions/ReaderExperiments@master] Image Browsing: improve VTOC item border styling

https://gerrit.wikimedia.org/r/1187873

@lwatson I posted a quick patch to address the issue you called out (the patch demo has not yet been updated to include it however).

Change #1187873 merged by jenkins-bot:

[mediawiki/extensions/ReaderExperiments@master] Image Browsing: improve VTOC item border styling

https://gerrit.wikimedia.org/r/1187873

Test Result - Patchdemo

Status: ✅ PASS / ❓Need More Info
Environment: beta/enwiki
OS: macOS Sequoia 15.5
Browser: Chrome Canary (latest as of test date)
Device: MS
Emulated Device: NA

Test Case 1: Verify small screen layout (<640px)

  1. Open https://patchdemo.wmcloud.org/wikis/7b60cdc924/wiki/Berlin
  2. Resize viewport to ≤640px width
  3. AC1: DetailView image fills viewport height with subject-detection cropping

screenshot 149.png (1×634 px, 1 MB)

  1. AC2: VTOC is rendered directly below DetailView in a single column

screenshot 150.png (1×634 px, 854 KB)

  1. AC3: VTOC images are fully visible, centered, and have height ≤300px

screenshot 151.png (1×634 px, 1 MB)

Test Case 2: Verify medium screen layout (>=640px ≤1000px)

  1. Resize viewport width to between 641px and 1000px
  2. AC4: VTOC renders in a 2-column alternating masonry layout
  3. AC5: VTOC images remain centered, fully visible, and height ≤300px

screenshot 152.png (1×646 px, 687 KB)

Test Case 3: Verify large screen layout (>1000px)

  1. Resize viewport width to >1000px
  2. AC6: DetailView and VTOC max out at 1000px width

I get 1093px, not sure if this is a concern.

  1. AC7: Backdrop element fills extra space on both sides
  2. AC8: DetailView image is constrained to 1000px width x 100vh height and cropped arbitrarily as needed

See AC6 about the width.

screenshot 153.png (1×1 px, 2 MB)

Discussed in standup and we're okay with breakpoint of 1093px

@Edtadros based on our conversation this morning, let me know if this task is ready to move forward to sign-off or if any other follow-up work is needed.

@egardner Given the precise cutoff isn't feasible, since @JScherer-WMF is okay with it it can move forward for sign-off.

Looks good, resolving!