Page MenuHomePhabricator

Nested subsections are incorrectly tagged with section number
Open, LowPublicBUG REPORT

Description

Web doesn't use a section number for some subsections w/o content. However, every section level in parsoid gets a section number. This causes issues downstream - when the mobile apps request a specific section's wikitext for a user to edit, it's the incorrect section because of this off-by-one error.

To replicate: Go to this subsection, tap edit. Visual Editor opens to the incorrect section.

See comment below for details on the investigation that led us here.


Original Title: Tapping "Edit" from the contextual menu in subsection opens subsequent subsection

Original Text:

How many times were you able to reproduce it?

Every time

Steps to reproduce

  1. Go to the article Hero’s journey on iOS.
  2. Under Campbell’s seventeen stages, navigate to Supernatural Aid or some other subsection.
  3. Select a word and tap Edit.

Expected results

The app will open the proper subsection and finds the word you selected.

Actual results

The app will open the subsection subsequent to the one you’ve attempted to edit, and it tries to find the word you selected in this section instead.

Environments observed

App version: 6.8.0
OS versions: 14.4.2
Device model: iPhone 7
Device language: EN

Affected articles?

  • Hero's journey on EN, but probably others with subsections.

Event Timeline

LGoto triaged this task as Low priority.Apr 26 2021, 6:43 PM
LGoto moved this task from Needs Triage to Bug Backlog on the Wikipedia-iOS-App-Backlog board.

Investigation:

  1. App calls window.wmf.editTextSelection.getSelectedTextEditInfo().
  2. This gets a section number from getSelectedTextSectionID (this is bundled in the app, not a PCS function).
  3. Looking at the source of the app's page (see image below), and comparing it to what we get from web (see text below, from https://en.wikipedia.org/wiki/Hero%27s_journey), assuming that tocsection should map to data-mw-section-id, we can see that the header Departure gets a section ID [[ view-source:https://en.wikipedia.org/api/rest_v1/page/mobile-html/Hero's_journey | in PCS ]] but not on web, causing the problem reported here.
  4. How does PCS set data-mw-section-id? Looks like it doesn't, from what I can see. And I see that in Parsoid tests (PCS pulls from Parsoid), so now to go upstream.

Next up: Figure out where data-mw-section-id is set, and figure out why there is a difference between web and mobile here.

Screenshot 6.png (296×453 px, 66 KB)

<li class="toclevel-1 tocsection-1"><a href="#Background"><span class="tocnumber">1</span> <span class="toctext">Background</span></a></li>
<li class="toclevel-1 tocsection-2"><a href="#Terminology"><span class="tocnumber">2</span> <span class="toctext">Terminology</span></a></li>
<li class="toclevel-1 tocsection-3"><a href="#Summary"><span class="tocnumber">3</span> <span class="toctext">Summary</span></a></li>
<li class="toclevel-1 tocsection-4"><a href="#Campbell&#39;s_seventeen_stages"><span class="tocnumber">4</span> <span class="toctext">Campbell's seventeen stages</span></a>
<ul>
<li class="toclevel-2"><a href="#Departure"><span class="tocnumber">4.1</span> <span class="toctext">Departure</span></a>
<ul>
<li class="toclevel-3 tocsection-5"><a href="#The_Call_to_Adventure"><span class="tocnumber">4.1.1</span> <span class="toctext">The Call to Adventure</span></a></li>
<li class="toclevel-3 tocsection-6"><a href="#Refusal_of_the_Call"><span class="tocnumber">4.1.2</span> <span class="toctext">Refusal of the Call</span></a></li>
<li class="toclevel-3 tocsection-7"><a href="#Supernatural_Aid"><span class="tocnumber">4.1.3</span> <span class="toctext">Supernatural Aid</span></a></li>
<li class="toclevel-3 tocsection-8"><a href="#The_Crossing_of_the_First_Threshold"><span class="tocnumber">4.1.4</span> <span class="toctext">The Crossing of the First Threshold</span></a></li>
<li class="toclevel-3 tocsection-9"><a href="#Belly_of_the_Whale"><span class="tocnumber">4.1.5</span> <span class="toctext">Belly of the Whale</span></a></li>
</ul>
</li>
<li class="toclevel-2 tocsection-10"><a href="#Initiation"><span class="tocnumber">4.2</span> <span class="toctext">Initiation</span></a>
<ul>
<li class="toclevel-3 tocsection-11"><a href="#The_Road_of_Trials"><span class="tocnumber">4.2.1</span> <span class="toctext">The Road of Trials</span></a></li>
<li class="toclevel-3 tocsection-12"><a href="#The_Meeting_with_the_Goddess"><span class="tocnumber">4.2.2</span> <span class="toctext">The Meeting with the Goddess</span></a></li>
<li class="toclevel-3 tocsection-13"><a href="#Woman_as_the_Temptress"><span class="tocnumber">4.2.3</span> <span class="toctext">Woman as the Temptress</span></a></li>
<li class="toclevel-3 tocsection-14"><a href="#Atonement_with_the_Father/Abyss"><span class="tocnumber">4.2.4</span> <span class="toctext">Atonement with the Father/Abyss</span></a></li>
<li class="toclevel-3 tocsection-15"><a href="#Apotheosis"><span class="tocnumber">4.2.5</span> <span class="toctext">Apotheosis</span></a></li>
<li class="toclevel-3 tocsection-16"><a href="#The_Ultimate_Boon"><span class="tocnumber">4.2.6</span> <span class="toctext">The Ultimate Boon</span></a></li>
MattCleinman renamed this task from Tapping "Edit" from the contextual menu in subsection opens subsequent subsection to Nested subsections are incorrectly tagged with section number.Apr 30 2021, 6:12 PM
MattCleinman raised the priority of this task from Low to Medium.
MattCleinman updated the task description. (Show Details)

Interesting .. I think Parsoid's behavior is the right one here (what if you want to add new content and convert that from an "empty" section to a non-empty one), but that does no one any good since the core notion of sections is what is used by section-edit links.

We'll see where it makes sense to fix this. Given that we haven't had this "bug" reported till now, this is likely an edge case.

I think I agree that Parsoid's behavior makes more sense to me. I don't know the feasibility of changing the legacy behavior though.

For what it's worth, this was a user-reported bug. However, only heard from one person.

On iOS it's only triggered when someone uses a context menu to tap "Edit", however, when that route is chosen we show only one section in the edit screen - and it's the incorrect one. Unlike on Visual Editor, you're unable to scroll up to get to the intended section. To be clear though, this only happens (in nested subsections) in a less-used route to the iOS edit screen.

Feel free to adjust priority downward if you think that's more appropriate.

ssastry lowered the priority of this task from Medium to Low.Apr 30 2021, 10:46 PM