
Google Lighthouse Warning is a tool that helps you identify areas of improvement on your website. It provides actionable recommendations to enhance user experience and performance.
A good score on Google Lighthouse is crucial for search engine rankings and user engagement. A score of 90 or above is considered excellent, while a score of 50 or below is considered poor.
You can check your website's score by running a Lighthouse audit, which will give you a detailed report of its performance. This report includes metrics such as First Contentful Paint, First Input Delay, and Total Blocking Time.
What Is Anyway?
Google Lighthouse is like your page's report card, giving you a detailed analysis of its performance, accessibility, and SEO.
It targets several aspects of the page, including performance, accessibility, and SEO. Google Lighthouse is an open-source tool, meaning it's free and community-driven.
At its core, Google Lighthouse is an automated auditing tool that scans a web page with an eagle eye. It doesn't just scan the page, but provides actionable feedback to improve it.
The importance of a Lighthouse audit is directly tied to the web's evolving dynamics, where speed and accessibility are not just a luxury, but a necessity.
Causes and Effects
An excessive DOM size can be caused by a variety of factors, including badly coded plugins in your CMS, DOM nodes created by JavaScript, and page builders that generate bloated HTML.
One common culprit is page builders like Elementor or WP Bakery, which can create unnecessarily complex HTML. This can lead to a larger DOM size and slower page loading times.
Another factor is text that's copied and pasted into a WYSIWYG editor like TinyMCE, which can also contribute to a bloated DOM. This is because these editors often add unnecessary HTML tags and attributes.
Bad template coding can also cause an excessive DOM size. This can be due to inefficient coding practices or a lack of understanding of how the DOM works.
A large DOM size can cause problems with page rendering, making it harder for your browser to display the page quickly. This can lead to a slower user experience and lower page load times.
Here are some of the specific problems caused by a large DOM size:
- The size of your HTML is larger, increasing the time it takes to download your page.
- A large DOM size slows down rendering performance, requiring your browser to do more calculations on first load and each time a user or script interacts with your page.
- Your browser uses more memory when interacting with the DOM via JavaScript.
Fixing and Optimizing
To fix the 'avoid excessive-DOM size' warning, you'll first need to trace its origins. Lighthouse will give you an indication of where the Maximum DOM Depth and Maximum Child Elements are located.
Use the DOM inspector of your web browser and check out the DOM. There are 5 usual suspects: badly coded plugins in your CMS, DOM nodes created by a JavaScript, page builders that generate bloated HTML, text copied and pasted into a WYSIWYG editor, and badly coded templates.
Badly coded plugins in your CMS can create a large amount of DOM nodes. Consider replacing this plugin with a more streamlined one. DOM nodes created by a JavaScript might inject a large number of DOM nodes into the DOM. Remove the JavaScript file or find a replacement with the same functionality.
Page builders like Elementor or WP bakery often create bloated code that has a large number of DOM nodes. Cleaning up your bloated code and changing your workflow might be the solution.
If you can't remove the excessive DOM size, there are workarounds to lessen the impact. Lazy loading parts of your webpage, improving page rendering with content visibility, splitting large pages into multiple pages, implementing infinite scroll, avoiding memory-intensive JavaScript, and avoiding complicated CSS declarations are some of the options.
Here are some specific things you can do:
- Lazy load parts of your webpage, like the footer
- Use the CSS content-visibility property to tell a browser to skip styling, layout, and paint until you need it
- Split large pages into multiple pages to reduce the number of DOM nodes
- Implement infinite scroll for repeated elements like images or large tables of data
- Avoid memory-intensive JavaScript and complicated CSS declarations
Understanding and Analyzing
Google Lighthouse warning can be overwhelming, but breaking it down is easier than you think. Each metric in the report represents a different aspect of your website's performance.
First Contentful Paint (FCP) measures the time from when the page starts loading to when any part of the page's content is rendered on the screen. A slow FCP can be caused by server response times, render-blocking JavaScript and CSS, and uncompressed images.
Speed Index (SI) measures how quickly the contents of a page are visibly populated. The lower the score, the better. To improve SI, optimize content efficiency, minimize main-thread work, and keep request counts low.
Largest Contentful Paint (LCP) reflects the time it takes to render the largest content element visible in the viewport. A slow LCP can be caused by server optimization, critical CSS, images, and font loading issues.
Time to Interactive (TTI) quantifies how long it takes a page to become fully interactive. Long TTI can be caused by third-party usage, JavaScript execution time, and high request counts.
Total Blocking Time (TBT) measures the total amount of time when the main thread was blocked long enough to prevent input responsiveness. To improve TBT, minimize long tasks, reduce JavaScript execution time, and keep sizes of network payloads small.
Cumulative Layout Shift (CLS) quantifies how much unexpected layout shift of visible page content occurs during page load. To improve CLS, ensure elements have a reserved space, avoid inserting new content above existing content, and avoid animations that cause layout shifts.
To decode the performance score, understand that it's a weighted average of metrics like FCP, SI, LCP, TTI, TBT, and CLS. Each metric is assigned a weight, reflecting its relative importance in the overall score.
Here's a quick reference guide to common Lighthouse issues and their corresponding recommendations:
Automated Testing and Web Accessibility
Automated testing plays a crucial role in web accessibility conformance. Lighthouse, an automated accessibility tool, checks your code against common standards to identify barriers that may affect users with disabilities.
Lighthouse uses a weighted average of pass-or-fail tests to calculate its accessibility score. Each issue is analyzed with a specific weight, and a high score signals a site that is accessible and inclusive.
Automated testing is not intended to find every barrier. In fact, Lighthouse's documentation has a disclaimer stating that only a subset of accessibility issues can be automatically detected, and manual testing is also encouraged.
Here are some common issues that automated testing might miss:
- Other misuses of the aria-hidden=”true” attribute that hide important content from AT users.
- Keyboard traps, which prevent keyboard users from navigating past content or changing their keyboard focus.
- CSS mistakes that prevent users from seeing keyboard focus and pointer focus indicators.
- Any WCAG criterion that requires human judgment, such as inaccurate image alt tags, subheadings, and page titles.
Lighthouse's limitations were demonstrated by developer Manuel Matuzovic, who built a site that is almost completely unusable, even with a mouse and keyboard, and still managed to achieve a perfect Lighthouse score.
Metrics and Feedback
Understanding the metrics in your Lighthouse report is key to interpreting and actioning the audit outcomes. Each metric shines a light on a different aspect of your website's performance, and together they provide a comprehensive overview of your site's health.
The Lighthouse report includes metrics such as First Contentful Paint (FCP), Speed Index (SI), Largest Contentful Paint (LCP), Time to Interactive (TTI), Total Blocking Time (TBT), and Cumulative Layout Shift (CLS). These metrics measure the time from when the page starts loading to when any part of the page's content is rendered on the screen, how quickly the contents of a page are visibly populated, and how long it takes to render the largest content element visible in the viewport.
Here are some common Lighthouse issues and recommendations for addressing them:
Each audit you run presents a specific test, pinpointing the areas of your webpage that need some TLC. The test results are broken down into sections: Passed Audits, Audits to Improve, and Failed Audits.
Key Metrics
First Contentful Paint (FCP) measures the time from when the page starts loading to when any part of the page's content is rendered on the screen. This is a crucial metric to focus on, as it directly impacts user experience.
Speed Index (SI) measures how quickly the contents of a page are visibly populated. The lower the score, the better.
Largest Contentful Paint (LCP) reflects the time it takes to render the largest content element visible in the viewport. This metric is essential for ensuring that users can access the most important content on your page quickly.
Time to Interactive (TTI) quantifies how long it takes a page to become fully interactive. This is a key metric for ensuring that users can engage with your page without frustration.
Total Blocking Time (TBT) measures the total amount of time when the main thread was blocked long enough to prevent input responsiveness. Minimizing TBT is vital for a smooth user experience.
Cumulative Layout Shift (CLS) quantifies how much unexpected layout shift of visible page content occurs during page load. This metric is crucial for maintaining a stable and predictable user experience.
Here's a quick overview of the key metrics to track:
Load Time (Seconds)
Load Time is a crucial aspect of website performance. It measures the time it takes for a web page to fully load.
A delay of even a second can spell doom for a website, pushing visitors away and affecting search engine rankings. Every second counts in the world of web performance.
In a world that moves at the speed of a scrolling thumb, a slow-loading page can have a significant impact on a website's bottom line. It's essential to use tools like Google Lighthouse to ensure optimal performance.
Load time is a key metric to track, and with Google Lighthouse, you can measure it in seconds.
Frequently Asked Questions
Is Google Lighthouse free?
Yes, Google Lighthouse is a free tool. It's also open-source, making it accessible to everyone.
How to open Lighthouse in Chrome?
To open Lighthouse in Chrome, click Lighthouse next to the address bar or in the extension menu. This will expand the Lighthouse menu, allowing you to generate a report.
How to check Lighthouse score?
To check your Lighthouse score, head to Google's PageSpeed Insights tool and look for the Performance score at the top of the Diagnose performance issues section. This score is collected from Lighthouse and provides a snapshot of your website's performance.
Sources
- https://www.corewebvitals.io/pagespeed/fix-avoid-excessive-dom-size-lighthouse
- https://developer.chrome.com/docs/lighthouse/overview
- https://agencyanalytics.com/blog/google-lighthouse-guide
- https://web.dev/articles/lighthouse-ci
- https://www.boia.org/blog/why-google-lighthouse-scores-arent-useful-for-evaluating-accessibility
Featured Images: pexels.com