Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WSTEAMA-763 Implement Lazy Loading for Message Banner + Billboard #11741

Draft
wants to merge 11 commits into
base: latest
Choose a base branch
from

Conversation

LilyL0u
Copy link
Contributor

@LilyL0u LilyL0u commented Jul 1, 2024

Temporarily has Pedram's code from the BFF until that PR is merged. This allows us to use the data in the form it will be. Having Pedram's work on the URL transformation there appears to allow lazy loading to now work!

Overall changes

Uses the lazyload boolean that already existed to add the lazy loading attribute.
Also passes in 'position' into the component because we need to stop the image lazy loading if the message banner or billboard is used as the first curation.

We have found that this lazy loading work in Chrome but not in Firefox. It seems that lazy loading requires a width in order to work properly, and we are using an aspect ratio in the message banner that overrides the width and height when passed into the image component. When I remove the aspect ratio and the lazy load attribute remains, the image now loads (lazily), but is the wrong dimensions. We need the aspect ratio to remain in order for the image to look right. So either we would need to work at somehow changing the code to not use the aspect ratio in this way (which we don't know is possible), or we leave the lazy loading attrubute being passed in and get the benefits of lazy loading on chrome, while sacrificing the image loading at all on Firefox.

Screenshot 2024-07-03 at 14 25 48

It has been decided to raise the issue with Mozilla to see if this can be fixed, and in the meantime leave the images not lazy loading. As the images are webp, they hopefully don't increase the page weight and performance too much now.

Code changes

  • A bullet point list of key code changes that have been made.

Testing

  1. List the steps used to test this PR.

Helpful Links

Add Links to useful resources related to this PR if applicable.

Coding Standards

Repository use guidelines

pvaliani and others added 5 commits July 3, 2024 10:52
…ement-lazy-loading-for-message-banner-and-billboard
…nd-billboard' of github.com:bbc/simorgh into WSTEAMA-763-implement-lazy-loading-for-message-banner-and-billboard
…-and-billboard' and 'WSTEAMA-763-implement-lazy-loading-for-message-banner-and-billboard' of github.com:bbc/simorgh into WSTEAMA-763-implement-lazy-loading-for-message-banner-and-billboard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants