Page MenuHomePhabricator

Put current use of SVG (icon) build task and integration on trial
Closed, DeclinedPublic

Description

Current implementation of SVG icons comes with disadvantageous side-effects:

  1. Icons, which aren't pre-defined to be a certain color, are not getting it. Example: Disabled icons. T114044: Disabled icon on any ButtonWidget should be gray. Currently `constructive` (colored).
  2. Every color fill means another pre-defined file, that might need to be in a
    • In v.0.15.4/MediaWiki theme we have 555 SVG icons:
      • 265 "-invert.svg", 85 are "-rtl-invert.svg"
      • 9 "-destructive.svg"
      • 8 "-progressive.svg"
      • 6 "-constructive.svg"
      • 2 "-warning.svg"
      • which leaves us with 265 "normal" icons (ltr and rtl)
  3. Difficult to add a new icon variant as there are three locations (JSON file, CSS)
  4. Little shade changes of color are only possible to add by quite a process, compare :hover shade changes of progressive blue
  5. Having separate SVG images of different states result in flickering of image when changing state, like :normal and :hover. Mislead in demo by not inlining background-images in contrast to ResourceLoader
  6. Issues with background-size: contain T93636: Indicator distorted in Firefox 31.5.0 & T94494: All icons and indicators blurry on IE 11, Edge 12-13

Event Timeline

ltr vs rtl is not a performance consideration as the direction icons are embedded once at CSS processing of RL. It wouldn't have a performance improvement to use for example [[ https://stackoverflow.com/a/19143438/1696030 | CSS transform]]

Inspiration for another way to implement SVG color filling: https://github.com/trysound/postcss-inline-svg ?

Volker_E renamed this task from Put current use of SVG build task and integration on trial to Put current use of SVG (icon) build task and integration on trial.May 5 2016, 5:41 PM

Having separate SVG images of different states result in flickering of image when changing state, like :normal and :hover.

This should only happen in development or debug mode. In production they are embedded and load directly from memory without a flash in between. More details at https://www.mediawiki.org/wiki/ResourceLoader/Features#Embedding.

Even if at some point we stop using image embedding, a design requirement will be that it must preload images used above the fold and preload alternate states before they are triggered (e.g. finish loading a dialog before displaying, and include hover states in the secondary warm up or something like that).

@Krinkle You're right, I was misleadingly alerted by the demo implementation.

@Jdlrobson and myself were discussing different performance impacts of replacing inlined SVGs via @embed like the -invert modifiers with [[ https://developer.mozilla.org/en-US/docs/Web/CSS/filter#invert()_2 | CSS filter invert ]] for probably enhancing experience in supporting browsers.

@Krinkle, we have had a discussion about this before, would you share your opinion and your insights here again? Let's leave aside browser support for a moment, we want to focus on the performance and RL side of it.

Volker_E changed the task status from Open to Stalled.Jan 23 2019, 8:38 PM

Waiting for CSS filters tests (coming this year?)… T198770: Use CSS filters to change icon colors

We're not going to invest any further in OOUI icon build process and focus instead on Codex.