Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions content/adr/html-loading-attribute
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@swarad07, the file is missing an extension. It doesn't get listed at all.

title: "Loading attribute in img and iframe HTML tags"
date: "2025-15-01"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The date is in the wrong format.

decision: "Loading attribute should be added on all img and iframe tags and set to lazy"
status: "accepted"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you intentionally setting this to "accepted". Do we need to discuss this or is this something so obvious we don't need to discuss?

categories:
- HTML
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is HTML a good name for this category? Perhaps we can club all web technologies in one.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to above

---

# Native LazyLoading for img and iframe

## Context

Images not only contribute to bandwidth and data usage but also slow down page loads, most images are often outside the viewport and cannot be viewed anyways on page load unless the user scrolls to them. We can optimise this by using the native loading attribute.

## Decision

- We shall ensure every <img> and <iframe> tag has the `loading` attribute and it is set to `lazy`
- The `loading` attribute has a default value set to `eager` which loads the image immediately irrespective of whether they are in the viewport.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this not load all the images on page load and opposite to lazy load? Should this value be rather lazy instead as per https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#loading

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think above is conveyed in 1st point however having this line here is kind of confusing as if we are deciding to set the value to eager. Maybe this line can be in context rather?


## Consequences

- **Positive:**
- Improved page loading performance due to lazy loading of images.
- Reduced data usage.
- **Negative:**
- Changes to <img> and <iframe> component templates needed in the CMS, JS framework, and UX library kits whenever a new project is bootstrapped.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a caveat that we change codes that are within our control like custom code only considering this -ve?

- It might not play well if JS libraries are used to handle image lazy loading for a smoother / animated UX, like skeletons.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel it would be better to explain what is the negative consequences we expect and explain "play well" part


## Status

- **Accepted**
Loading