Page MenuHomePhabricator

mw-empty-elt elements should be visible when editing
Closed, ResolvedPublic

Description

On https://en.wikipedia.org/w/index.php?title=Alan_Pardew&oldid=1051346054&veaction=edit the first paragraph which only contains {{use dmy dates}} gets put in a <p> with the mw-empty-elt class which sets display: none.

In the editor this causes two problems: the template is not editable or removable (unlike {{Use British English}}), and the cursor is placed in that paragraph, so no cursor is visible when the page loads.

Another simple use case:

wikitext:

* Foo
*
* Bar

In VE, the middle hidden list item is hidden

Testing

  1. Create a page with the sparse wikitext list above (* Foo ...)
  2. Open the page in VE

Observed

  1. The middle empty list item is not visible or editable

Expected

  1. The middle empty list item is visible and editable

Event Timeline

The documentation of the class suggests removing mw-hide-empty-elt from <body> however this will not work when the page has mixed reading and editing content (e.g. DiscussionTools, or a preview within VE).

Equally we can't override the CSS selector, because you can't "undo" adding display:none, the original display could have been inline, block, list-item, etc.

Change 739801 had a related patch set uploaded (by Esanders; author: Esanders):

[mediawiki/core@master] Allow individual sections to show mw-empty-elt with an override

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

Change 739802 had a related patch set uploaded (by Esanders; author: Esanders):

[mediawiki/extensions/VisualEditor@master] Add mw-show-empty-elt to MW surfaces

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

Change 739805 had a related patch set uploaded (by Esanders; author: Esanders):

[mediawiki/skins/Timeless@master] Support mw-show-empty-elt added in core

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

Esanders moved this task from To Triage to Triaged on the VisualEditor board.
Esanders moved this task from Incoming to Code Review on the Editing-team (Kanban Board) board.

Test wiki created on Patch Demo by ESanders (WMF) using patch(es) linked to this task:

https://patchdemo.wmflabs.org/wikis/0a958cc5e8/w/

This comment was removed by Esanders.

Change 739801 merged by jenkins-bot:

[mediawiki/core@master] Allow individual sections to show mw-empty-elt with an override

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

Change 739802 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Add mw-show-empty-elt to MW surfaces

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

Change 739805 merged by jenkins-bot:

[mediawiki/skins/Timeless@master] Support mw-show-empty-elt added in core

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

Test wiki on Patch demo by ESanders (WMF) using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/0a958cc5e8/w/