Page MenuHomePhabricator

Template (puzzle) icon displaces images/templates
Closed, ResolvedPublic8 Estimated Story Points

Description

For a simple template which simply embeds and image I encountered the following strange behaviour.

When entering VE the puzzle icon is placed where the image is normally situated pushing that image downwards. Since the template is used in lists and since displacing the image does not increase the line hight the results are a bit weird as can be seen in the example below.

Possible solutions:

  • Make the puzzle-icon not appear (it doesn't appear for all templates but I could find no documentation on what triggers it's appearance).
  • Force line hight to be increased by the height of the puzzle-icon (while the end result will still look weird you won't have images overlapping each other.

Event Timeline

Possibly the problem is related to VE thinking that an image is a hidden template. If I modify the template by having it also add some random text the issue (i.e. puzzle icon) disappears.

Part of the problem will be hasRendering, which iterates using this.$element.each which only checks first level descendants of this.$element. If the image is wrapped in a few spans it won't get detected.

The other issue is one that's come up a few times, which is that in MW, the first setup of nodes happens which the surface is hidden, and therefore not measurable. We may want to consider hiding it in a way that preserves layout (e.g. wrapped in a height:0; overflow:hidden;).

Change 272763 had a related patch set uploaded (by Esanders):
Make surface measurable while activating

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

Change 272763 merged by jenkins-bot:
Make surface measurable while activating

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