Page MenuHomePhabricator

[New component] Skeleton: Add Skeleton loader component to Codex
Open, Needs TriagePublic

Assigned To
None
Authored By
• Sarai-WMDE
Jul 1 2022, 5:10 PM
Referenced Files
F34409748: image.png
Feb 14 2024, 2:51 PM
F34409746: image.png
Feb 14 2024, 2:51 PM
F35685981: image.png
Feb 14 2024, 2:51 PM
F34409740: image.png
Feb 14 2024, 2:51 PM
F41483672: Reading theme logged in no tools - skeleton.png
Nov 10 2023, 5:05 PM
F41483673: Reading theme logged in unhide - skeleton.png
Nov 10 2023, 5:05 PM
F35753745: Captura de Pantalla 2022-11-11 a las 11.56.54.png
Nov 11 2022, 10:57 AM
F35753705: Captura de Pantalla 2022-11-11 a las 11.46.48.png
Nov 11 2022, 10:57 AM

Description

NOTE: this task should be reformatted to the mvp component template T329320

Background

  • Description: Skeletons are loading indicators that take the approximate shape of the UI elements they are acting as a placeholder for.
  • History: There are two main tasks and threads that should be taken into consideration when tackling the definition of this pattern: T280842: Define and add guidelines for adding skeleton/placeholder UI to the DSG and T266028: Add “Progress indicators” to DSG.
  • Known use case(s): Skeleton loaders are currently used in production in the following scenarios: Within Growth's Newcomer homepage suggested edits modules (or cards), as loading indicators for images in Wikipedia articles (only in Minerva), as loading indicators for the main search's menu item thumbnails in Minerva.
  • Considerations: This pattern should be approved by the design team before being introduced in our design system. Its place among other progress/loading indicators (T266028) and usage recommendations should also be properly defined.

Further details are available in the following product document.

User stories

  • As a designer and developer, I want to be able to reuse a skeleton animation to visually indicate to users that UI content is loading.

Previous implementations

These artifacts are listed for historical context. The figma spec, linked below, is the source of truth for the new component.

The most relevant implementations of skeleton loaders are in MobileFrontend and Minerva skin (using the class .image-lazy-loaded), and GrowthExperiments project (.se-card-image.skeleton, .se-card-extract.skeleton, .se-card-pageviews.skeleton).

Growth newcomer homepageImage thumbnails on articlesImage thumbnails on search (Minerva)
T263040 Suggested edits module
image.png (2,392×1,660 px, 261 KB)
T321675 Impact module
image.png (934×1,270 px, 113 KB)
image.png (2,186×1,948 px, 897 KB)
image.png (1,144×2,028 px, 456 KB)

Open questions

  1. Skeleton size: Is it possible to make the skeleton size to adjust to the size of the element that it’s replacing (i.e., be 100% in height in width), or should we create different predefined skeleton sizes? (e.g. 16px, 24px, 40px height)
    Captura de Pantalla 2022-11-11 a las 11.56.54.png (550×772 px, 133 KB)
    • @Volker_E 2026-04-27: tl;dr There should be a small set of primitives, "consumer-composed". The CdxSkeletonComponent to come with shape prop with rectangle as default, line as possible 2nd on MVP, and further down in development circle could be another value. rectangle for all imagery loading states, line additional for text row loading. height with sensible default per shape, width as filling container default.
  1. Skeleton color: Do we need a lighter version of the skeleton to make it work if combined with darker backgrounds (see example)? e.g. frameless tabs, which are using the same gray tone as the skeleton. (Note 2026-04-28: This old open question might be solved thanks to Codex's compatibility with dark mode)
    Captura de Pantalla 2022-11-11 a las 11.46.48.png (1,428×778 px, 234 KB)
  2. Skeleton sequence: Could implementers control the sequence in which skeletons load? (e.g. via animation delay) Sh/could this be a prop?

Codex implementation

  • Composition model:
    • 1. skeleton prop on existing components
      • Adding skeleton prop to existing components is the wrong direction for Codex:
        • Every current and future component that needs a skeleton state gets more complex API surface
        • Skeleton is a rare loading state; it should not pollute CdxCard, CdxThumbnail, etc.
        • Skeleton layouts often represent partial loading (just the image, not the whole card) - a per-component prop cannot express that
    • 2. Per-component companions (CdxCardSkeleton)
      • have the same maintenance problem and cause component explosion.

therefore

    • 3. a small set of shape primitives, consumer-composed
  • Accessibility measurements
    • Must-have: The visual skeleton element is aria-hidden="true" (decorative)
    • Nice-to-have: The component automatically renders a visually-hidden <span role="status"> adjacent to it, with a default i18n'd label (e.g. "Loading", overridable via prop)

Component task owners

  • Designer: @Sarai-WMDE
  • Developer: add the main developer's name

Design spec


Stage 1: Minimum viable product (MVP)

MVP includes basic layout, default states, and most important functionality.

Acceptance criteria

  • Determine what MVP includes for this component and document this in a subtask. Assign task to designer.
  • Design MVP.
    • Get approval by Product design team
    • Once complete design MVP, assign task to developer.
  • Implement MVP

Stage 2: Additional states, features, and variants

Acceptance criteria

  • Document design and implementation of additional states and features in individual subtasks
  • Complete each additional state/feature subtask

Stage 3: Refinement

Acceptance criteria

  • Finalize docs: open and complete a subtask for any additional demos that need to be added or documentation that needs work
  • Update loading guidelines added in T377434 with relevant information about Skeleton loaders
  • Meet accessibility standards: open and complete a subtask for any necessary accessibility improvements
  • Meet internationalization standards: open and complete a subtask to fix any i18n bugs
  • Complete testing: open and complete a subtask for any additional unit or functional tests that are needed

Details

Related Changes in Gerrit:

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

The Figma spec sheet for the Skeleton has been created and is ready to be implemented.

@RHo once the skeleton is implemented we will create another task to implement the skeleton state in Card component T256036 and other components where we need this loading state (such as menu-items with data, table component, etc.). You can review the spec sheet and provide feedback if needed.

bmartinezcalvo renamed this task from Design and build skeleton loader to Design and build Skeleton loader.Nov 9 2022, 7:23 PM

Currently

The Figma spec sheet for the Skeleton has been created and is ready to be implemented.

@RHo once the skeleton is implemented we will create another task to implement the skeleton state in Card component T256036 and other components where we need this loading state (such as menu-items with data, table component, etc.). You can review the spec sheet and provide feedback if needed.

Thanks for the ping @bmartinezcalvo. It largely looks fine to me, but one aspect that is missing/not addressed is having an order and delay of the loading animation of the different skeleton elements. By that I mean, for example in a list of articles, having a cascade effect with the first item "shimmering" across and downwards. I have a rudimentary example in this codepen that was created for one place where the Growth team uses skeletons.

On that note, there are 3 different places where Growth uses/plans to use skeletons for reference:

  1. Suggested edits module (see T263040)
  2. Post-edit dialog (see T294835, which is a task to solve some jankiness with the skeleton behaviour)
  3. Planned skeleton for New Impact module being built with Vue - see T321675.

Thanks for the ping @bmartinezcalvo. It largely looks fine to me, but one aspect that is missing/not addressed is having an order and delay of the loading animation of the different skeleton elements. By that I mean, for example in a list of articles, having a cascade effect with the first item "shimmering" across and downwards. I have a rudimentary example in this codepen that was created for one place where the Growth team uses skeletons.

@RHo we could use that gradient or use simply the background-color-interactive as a flat color. We decided to use the color instead since we don't have any gradient in our system at the moment and we should add it as token if we want to use it for the skeleton, which would slow down the implementation. Y recommend to use the background-color-interactive as a flat color for now and then study if we want to apply a gradient. You can check an example of skeleton without gradient in this Figma loading.

Captura de Pantalla 2022-11-10 a las 10.41.21.png (1,922×960 px, 323 KB)

Hey @RHo. Thanks so much for your help!

I think that keeping the animation-delay property custom is what will allow teams to freely set the loading order of the skeletons, and achieve the cascading effect you are referring to:

Screenshot 2022-11-10 at 10.42.33.png (890×664 px, 74 KB)

It would be great to get confirmation about this from engineers.

Thanks for the ping @bmartinezcalvo. It largely looks fine to me, but one aspect that is missing/not addressed is having an order and delay of the loading animation of the different skeleton elements. By that I mean, for example in a list of articles, having a cascade effect with the first item "shimmering" across and downwards. I have a rudimentary example in this codepen that was created for one place where the Growth team uses skeletons.

@RHo we could use that gradient or use simply the background-color-interactive as a flat color. We decided to use the color instead since we don't have any gradient in our system at the moment and we should add it as token if we want to use it for the skeleton, which would slow down the implementation. Y recommend to use the background-color-interactive as a flat color for now and then study if we want to apply a gradient. You can check an example of skeleton without gradient in this Figma loading.

Captura de Pantalla 2022-11-10 a las 10.41.21.png (1,922×960 px, 323 KB)

Thanks @bmartinezcalvo - the current implementation we have doesn't have a gradient so don't think this is an issue. The change in colour at different times I'm talking about is through animation-delay and changing the opacity of the skeleton element.

Hey @RHo. Thanks so much for your help!

I think that keeping the animation-delay property custom is what will allow teams to freely set the loading order of the skeletons, and achieve the cascading effect you are referring to:

Screenshot 2022-11-10 at 10.42.33.png (890×664 px, 74 KB)

It would be great to get confirmation about this from engineers.

Thanks for clarifying @Sarai-WMDE and will await confirmation from Eng. I think it could be useful to have in the spec a recommendation about whether to cascade or not, in what circumstances. For example it might be nice for items in a list or multi-lines in a chunk of text, but not to have it across different loading elements (card image, title, body text)

Providing som open questions for the skeleton:

  1. Will skeleton be needed in tab component? If yes, we need to find a solution for the framed tabs since they are using the same gray tone as the skeleton.
    Captura de Pantalla 2022-11-11 a las 11.46.48.png (1,428×778 px, 234 KB)
  1. Should skeleton be the same size of the element that is replacing or should we create different predefined skeleton sizes? (e.g. 16px, 24px, 40px height)
    Captura de Pantalla 2022-11-11 a las 11.56.54.png (550×772 px, 133 KB)

Hello just wanted to share that we are following similar pattern in our project for loading content in quick view. In our next iteration we can align this to your final proposal if you notice any discrepancies. Here is the Phab ticket that outlines the behaviour T318951.

CCiufo-WMF moved this task from Backlog to Design Upcoming on the Design-System-Team board.

We're hoping to implement a version of this for the type settings interface. See T350612. Here's what that's looking like right now based on the Figma above.

Reading theme logged in unhide - skeleton.png (1,536×922 px, 311 KB)

Reading theme logged in no tools - skeleton.png (1,536×922 px, 337 KB)

CCiufo-WMF renamed this task from Design and build Skeleton loader to Skeleton: Add Skeleton loader component to Codex.Feb 15 2024, 8:31 PM
CCiufo-WMF raised the priority of this task from Low to Needs Triage.
CCiufo-WMF added a project: Design.
CCiufo-WMF removed a subscriber: • Prtksxna.
DTorsani-WMF renamed this task from Skeleton: Add Skeleton loader component to Codex to [New component] Skeleton: Add Skeleton loader component to Codex.Jul 29 2025, 2:20 PM
Volker_E edited subscribers, added: Sarai-WMF; removed: • Sarai-WMDE.

Change #1277886 had a related patch set uploaded (by VolkerE; author: VolkerE):

[design/codex@main] Skeleton: Add initial WIP component

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