Add the loading="lazy" attribute to prioritize loading other resources first

Created on 11 June 2024, 14 days ago
Updated 12 June 2024, 13 days ago

Problem/Motivation

When using a JavaScript design system in conjunction with the iconset module, iconset icons are loaded before other essential elements have finished loading.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States shaal Boca Raton, FL

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @shaal
  • Status changed to Needs review 14 days ago
  • πŸ‡ΊπŸ‡ΈUnited States shaal Boca Raton, FL
  • Status changed to Needs work 13 days ago
  • πŸ‡ΊπŸ‡ΈUnited States lemming

    Hi @shaal it's good to hear from you, I hope things are going well.

    I think that this is a good idea, and I am happy to help get this ready. I have a couple items that I'm hoping to get your opinion on related to this.

    1. The module supports multiple types of icon types (icon handler plugins). For all the image based ones this is obvious, but for SVG sprite / symbols or for font based icons this should be ignored, or should these be "deferred"? We'll need to pass this option to the icon handler and have it decide how to apply the setting.

      An existing example is how the "decorative" flag is being handled. The value is passed to the handler with the "IconHandlerInterface::build()" method and it builds the icon renderable array.
    2. I think the option can be applied at the iconset level and the field formatter (like with Drupal Core image). So I'm thinking of having an optional "loading" option (with a global default) that has:
      • lazy - Icons are loaded lazy if the handler supports it - no option appears on formatter
      • eager - Icons are loaded with eager attribute if appropriate - no option appears on formatter
      • field - Setting is available per field - option appears on formatter with a preferred default pre-set

    I'm interested in working on this more in the next week or so, if you don't beat me to it, but your input or ideas on this would be great. Especially on how you think this applies best to the other cases like font based icons (ignore this option?) and SVG Symbols & Sprites.

Production build 0.69.0 2024