opportunity-hack / frontend-ohack.dev

https://frontend-ohack-dev.vercel.app
6 stars 51 forks source link

☀️ 👯‍♀️ Fix UX Performance | Core Web Vitals Problems #175

Open gregv opened 5 months ago

gregv commented 5 months ago

Cumulative Layout Shift (CLS) is one of the three Core Web Vitals metrics. It measures the instability of content by combining how much visible content has shifted in the viewport with the distance the affected elements moved.

Layout shifts can be distracting to users. Imagine you've started reading an article when all of a sudden elements shift around the page, throwing you off and requiring you to find your place again. This is very common on the web, including when reading the news, or trying to click those 'Search' or 'Add to Cart' buttons. Such experiences are visually jarring and frustrating. They're often caused when visible elements are forced to move because another element was suddenly added to the page or resized.

To provide a good user experience, sites should strive to have a CLS of 0.1 or less for at least 75% of page visits.

Improving CLS - Task Breakdown

The goal is to reduce Cumulative Layout Shift (CLS) on our website to improve user experience, aiming for a CLS of 0.1 or less for at least 75% of page visits. Below are the tasks to achieve this:

1. Placeholders

2. Image Optimization

3. Ad and Embed Handling

4. Font Loading Optimization

5. Dynamic Content Management

6. UI Component Stabilization

image

We have 20 issues with our website where all are Cumulative Layout Shift (CLS) issues. You can team up with people to solve these, or work on them on your own, and these usually make for a good first issue to work on.

image

Example

Page: https://www.ohack.dev/nonprofit/8bb71dc2077811edbfdeb29c4ac23549 PageSpeed Report: https://pagespeed.web.dev/analysis/https-www-ohack-dev-nonprofit-8bb71dc2077811edbfdeb29c4ac23549/oxpqx17w04?utm_source=search_console&form_factor=desktop&hl=en image

All URLs

gregv commented 4 months ago

Example before image

After adding Skeleton there doesn't appear to be an improvement, so some tweaking still needs to be done image

Still seeing 4 different layout shifts - need to get this down to 1 PageSpeed_Insights

cc: @CobyW98

gregv commented 4 months ago

That last commit is what we want @CobyW98 - I moved what was in a component up into the page

https://pagespeed.web.dev/analysis/https-ohack-dev-office-hours/kxqh5sw3cn?form_factor=desktop