Page MenuHomePhabricator

Add a class (mw-file-element) on the media element in the media structure?
Closed, ResolvedPublic

Description

The generic media structure looks like,

<wrapper> figure,span
  <link> a,span
    <media element> audio, video, img, etc.

and the less mirrors that,

figure[ typeof~='mw:File' ]
  > *:first-child
    > img,
    > audio,
    ...

The list of possible elements for the media element is growing. In addition to audio, video, img it can be a picture or soon a model. In T304343, it's clear that TimedMediaHandler would like to swap out the media element for some spans but maintain the styling.

In T304010, it's request to

Please just use classes instead

Mirroring the dom in css is something we'd like to get away from as well, from T270150#7211201

One level of child combinators are necessary because media can be nested in the figcaption,

<wrapper>
  <link>...</link>
  <caption>...</caption>
</wrapper>

and styles should not apply in there. There's a slight issue that active formatting elements can be reopened as direct descendants of the figure, but that's being looked at in T314059.

So the less would simplify to something like,

figure[ typeof~='mw:File' ]
  > *:first-child .mw-file-element

The counterpoint is bloat that this adds, which is a concern of T297984

Event Timeline

Arlolra triaged this task as Medium priority.
Arlolra moved this task from Needs Triage to Media Structure on the Parsoid board.

Change 812384 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/core@master] Use a universal selector (*) to match the media element

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

Change 812387 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/extensions/TimedMediaHandler@master] Swap the media element with a span

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

Change 812384 merged by jenkins-bot:

[mediawiki/core@master] Use a universal selector (*) to match the media element

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

Change 812387 merged by jenkins-bot:

[mediawiki/extensions/TimedMediaHandler@master] Swap the media element with a span

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

Change 820544 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/extensions/TimedMediaHandler@master] Stop requiring resources/config.json

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

Change 820544 merged by jenkins-bot:

[mediawiki/extensions/TimedMediaHandler@master] Stop requiring resources/config.json

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

The counterpoint is bloat that this adds, which is a concern of T297984

So, for now, we've gone with a universal selector in T314097#8129794

There's a slight issue that active formatting elements can be reopened as direct descendants of the figure, but that's being looked at in T314059.

That's resolved and should be asserted.

Mirroring the dom in css is something we'd like to get away from as well, from T270150#7211201

We can revisit this there

Change 901726 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/core@master] [WIP] Add classes

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

Change 902121 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/services/parsoid@master] [WIP] Add classes

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

Change 902203 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/core@master] [WIP] Update styles with classes

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

Change 901726 merged by jenkins-bot:

[mediawiki/core@master] Add classes on elements inside the media structure

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

Change 918615 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/extensions/VisualEditor@master] Preserve classes on all file elements, not just broken images

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

Change 918615 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Preserve classes on all file elements, not just broken images

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

Change 902121 merged by jenkins-bot:

[mediawiki/services/parsoid@master] Add classes on elements inside the media structure

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

Change 919886 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/vendor@master] Bump parsoid to 0.18.0-a10

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

Change 919886 merged by jenkins-bot:

[mediawiki/vendor@master] Bump parsoid to 0.18.0-a10

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

Change 902203 merged by jenkins-bot:

[mediawiki/core@master] Remove unneeded wildcard selectors

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

Change 922942 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/skins/MinervaNeue@master] Make use of mw-file-element class

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

Change 922942 merged by jenkins-bot:

[mediawiki/skins/MinervaNeue@master] Make use of mw-file-element class

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

  NODES
Note 9
Project 13
Verify 8