Page MenuHomePhabricator

Enable section collapsing on Parsoid HTML
Closed, ResolvedPublic3 Estimated Story Points

Description

Background

Follow up work to T359001

User story

As a reader on office wikimedia and other projects using Parsoid I want to be able to collapse sections.

Requirements

  • JavaScript/CSS has been added that allows sections to be collapsed or expanded.
  • The code is guarded so it only applies to Parsoid views.
  • The sections are expanded by default (pending no decision on T363933 we will do the simplest possible thing here in the mean time)
  • Section collapsing has appropriate semantics indicating the expanded/collapsed status of a section, and that the header is a button. Reference the original accessibility implementation of section collapsing to confirm

Note: Remembering collapsed/expanded sections on back button is not in scope for this ticket.

Requirement

Enable section collapsing on Parsoid HTML, ensuring sections can be expanded or collapsed by clicking the heading or arrow, and that collapsed sections are searchable using "Find in page".

BDD

Feature: Section Collapsing on Parsoid HTML

  Scenario: Expand and Collapse Sections
    Given the user is viewing a page with sections in Parsoid HTML
    When the user clicks on a section heading or arrow
    Then the section should collapse or expand

  Scenario: Search Within Collapsed Sections
    Given the user is using "Find in page"
    When the user searches for text in collapsed sections
    Then the text should be searchable

Test Steps

Test Case 1: Expand and Collapse Sections

  1. Navigate to an article page.
  2. Click on a section heading or arrow.
  3. AC1: Confirm that the section collapses or expands.

Test Case 2: Search Within Collapsed Sections

  1. Navigate to an article page.
  2. Use "Find in page" to search for text in a collapsed section.
  3. AC2: Confirm the text in the collapsed section is searchable.

QA steps

  • If I view a page with sections, I can expand and collapse sections by clicking on the heading or the up/down arrow.
  • I can use "Find in page" on text in collapsed sections.

Rollback plan

None necessary due to feature flag.

This task was created by Version 1.0.0 of the Web team task template

QA Results - Beta

ACStatusDetails
1T363934#9942531

QA Results - Prod

ACStatusDetails
1T363934#10020126
2T363934#10020126

Event Timeline

Jdlrobson set the point value for this task to 3.

We have some proof of concepts. Scope should be relatively tight.

Picking up ahead of next week's sprint - will gladly put down if something higher priority is needed

There are now higher priority things that can be worked on - putting this down, but I reviewed the proofs of concept (first attempt and second) and agree with the approach. I think some analysis needs to be done on whether jQuery should be avoided entirely considering the current state, but however this is done, it should work

I would say that any new code by web team should not be using jQuery.

Change #1040239 had a related patch set uploaded (by Bernard Wang; author: Bernard Wang):

[mediawiki/extensions/MobileFrontend@master] POC: Enable section collapsing

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

bwang removed bwang as the assignee of this task.Jun 11 2024, 5:22 PM
bwang moved this task from Doing to Code Review on the Web-Team-Backlog (FY2023-24 Q4 Sprint 5) board.
bwang subscribed.

Steph could you please take over review? This change looks good to me codewise, and I think you have all the background needed to review this! Thanks in advance!

Change #1040239 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] Enable section collapsing

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

Change #1043885 had a related patch set uploaded (by Stoyofuku-wmf; author: Stoyofuku-wmf):

[mediawiki/extensions/MobileFrontend@master] Extend section header bottom border to include edit button

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

Change #1043885 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] Extend section header bottom border to include edit button

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

Test Result - Beta

Status: ✅ PASS
Environment: Beta
OS: macOS Sonoma 14.5
Browser: Chrome 126
Device: MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test link: https://en.m.wikipedia.beta.wmflabs.org/wiki/Harry_Potter

✅ AC1: I can expand and collapse sections by clicking on the heading or the up/down arrow.

2024-07-01_13-31-30.mp4.gif (726×1 px, 841 KB)

✅ AC2: I can use "Find in page" on text in collapsed sections.

2024-07-01_13-32-31.mp4.gif (600×1 px, 2 MB)

GMikesell-WMF assigned this task to ovasileva.
GMikesell-WMF updated the task description. (Show Details)
GMikesell-WMF subscribed.
ovasileva added a subscriber: MSantos.

All done here! cc @MSantos

Test Result - Prod

Status: ✅ PASS
Environment: enwiki
OS: macOS Sonoma
Browser: Chrome
Device: MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Expand and Collapse Sections

  1. Navigate to an article page.
  2. Click on a section heading or arrow.
  3. AC1: Confirm that the section collapses or expands.

screenshot 14.mov.gif (1×560 px, 1 MB)

Test Case 2: Search Within Collapsed Sections

  1. Navigate to an article page.
  2. Use "Find in page" to search for text in a collapsed section.
  3. AC2: Confirm the text in the collapsed section is searchable.

screenshot 15.mov.gif (1×560 px, 1 MB)