Page MenuHomePhabricator

floatleft/right classes not documented great
Open, MediumPublic

Description

T366314#9869650 and some following discussion has comments that suggest floatleft and floatright classes are supported for general use of marking up floating content. I find the documentation around these classes a bit rough, with some actionables in various files and onwiki. (I think there's probably merit to using floatleft/right as a general class per previous discussion in T78176. Non-general use can use TemplateStyles where necessary.)

  1. https://www.mediawiki.org/wiki/Manual:$wgUseLegacyMediaStyles currently says they are part of the legacy media display (which was started as part of T354740). The relevant classes were originally used at some point for thumb markup, and then Parsoid and/or figure migration for Parser.php changed how relevant elements were styled, so that makes sense.
    1. Is their use shifting? This documentation should be updated if so.
    2. If in fact they are still connected to this parameter, it would be wise to disconnect them on the software side if indeed the use is shifting (see also #3/#4).
  2. This general use should be documented on wiki somewhere, and given the context in which it's used, that should probably be at the mobile recs page # Inline styles should not use properties that impact sizing and positioning.
  3. content.thumbnails-print.less currently removes their borders. This looks like a now-unnecessary holdover from their use in the thumbnail context and can be removed (after checking that the figure structure is printing whatever is desired here without them)?
  4. content.thumbnails-common.less contains the actual CSS, but if they're now being suggested for general use, they probably shouldn't be living in a file pertaining to thumbnails (see also #1B). (The new CSS looks like it's in content.media-common.less.)
  5. content.thumbnails-screen.less still contains a reference to these classes despite them being now-absent.
  6. Lastly, a minor suggestion to improve their definitions: the margins are currently living separate to the clear/float definitions for some reason (don't want the margins to apply to tleft/right? resolved by moving floatleft/right out of the same place), but these objects probably shouldn't have their own margins (or at least left/right margins) when they're below the mobile breakpoint in responsive skins.

I realize this is kind of a grabbag but it all also kind of goes together.

Event Timeline

Jdlrobson added a project: Documentation.
Jdlrobson added subscribers: apaskulin, ssastry, Jdlrobson.

@apaskulin and @ssastry I could do with some help with this next week!

The other thing that pops into mind is that floatleft/right have a clear: left/right on them and that isn't always wanted, and the uses where it's not wanted aren't always in a TemplateStyles area. Probably it's fine not to cover this case since it's not relevant the vast majority of the time when someone wants a floating thing since they're there for the reason to prevent generally the unaesthetic appearance of two stacked floating things, and could maybe be worked around with a general template if necessary.

"https://www.mediawiki.org/wiki/Manual:$wgUseLegacyMediaStyles currently says they are part of the legacy media display"

This is true and also wrong (and yes, I've edited that page before and not noticed it back then). They are NOT needed for the new image syntax, and were used in the legacy syntax. They were also put behind that flag (I would argue erroneously). But floatleft/right are scoped to table and div elements for a reason. If they were media specific, they'd have been scoped to media specific classes or elements at some point. Yes they originally were used for and introduced by image rSV1551 (2003). But their usage had long since expanded beyond that to tables, see rSVN4142 (2004) and other divs.

This just got moved around a couple of times and people forgot the table usage, causing this mixup.

Change #1054356 had a related patch set uploaded (by Steven Rawson; author: Steven Rawson):

[mediawiki/core@master] Remove comment about floatleft/floatright/tright/tleft location

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

Change #1054356 merged by jenkins-bot:

[mediawiki/core@master] Remove comment about floatleft/floatright/tright/tleft location

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