Page MenuHomePhabricator

Indented list items lose formatting when switching between bulleted & numbered list styles
Closed, ResolvedPublic

Description

Indented list items lose their formatting when you switch their list style more than once. (The first time you switch the list style, it works as expected; but if you switch it again, formatting is lost.)

To see this in action:

  1. Create a list that is two or more levels deep. You can use either list style.
    list-formatting-ex-step-1.jpg (316×560 px, 75 KB)
  2. Select one or more items in the second level or deeper, and change the list style. (This works as expected.)
    list-formatting-ex-step-2.jpg (316×560 px, 69 KB)
  3. Select THE SAME list items and switch back to the original list style. The formatting is lost.
    list-formatting-ex-step-3.jpg (316×560 px, 66 KB)

This problem doesn’t occur with first-level items. With those, you can switch back and forth between list styles many times without ever losing formatting.

Event Timeline

matmarex added subscribers: Esanders, JTannerWMF, matmarex.

From the other task, which describes the same problem at a "lower level":

hasMatchingAncestor is the wrong check for list tools
We currently traverse the entire node tree to determine if a particular context is inside a list, for the purpose of showing the state of the list tools, and deciding what action to take when they are used, or what tab is pressed.

What we actually care about is whether the immediate branch node container is a listItem, not the entire tree, for example:

*
* # This context thinks it has a bullet list ancestor, but we should only return true for numbered list ancestor

image.png (238×696 px, 25 KB)

Also a table cell inside a table inside a list reports as having a list ancestor, even though we shouldn't treat that as a list item context. (This is more of an edge case as it shouldn't be possible in normal wikitext)

Change 785865 had a related patch set uploaded (by Bartosz Dziewoński; author: Esanders):

[VisualEditor/VisualEditor@master] ve.dm.SurfaceFragment: Add matchFirstAncestorOfType option

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

Change 785865 merged by jenkins-bot:

[VisualEditor/VisualEditor@master] ve.dm.SurfaceFragment: Add matchFirstAncestorOfType option

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

Change 790452 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (e54ef8d1c)

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

Change 790452 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (e54ef8d1c)

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

Initial list style:

Screenshot 2022-05-27 at 00.22.53.png (626×1 px, 45 KB)

Changed to Bulleted:

Screenshot 2022-05-27 at 00.26.55.png (704×1 px, 45 KB)

Switched back to the original list style:

Screenshot 2022-05-27 at 00.27.41.png (654×1 px, 42 KB)

ppelberg claimed this task.