clean-and-green-philly icon indicating copy to clipboard operation
clean-and-green-philly copied to clipboard

Task: Audit performance of Accessibility Statement page

Open CodeWritingCow opened this issue 1 year ago • 10 comments

Describe the task

Audit performance of Clean and Green Philly's Accessibility Statement page using Google Lighthouse. Document audit results, including areas of improvement.

Acceptance Criteria

  • [x] Generate Lighthouse report for mobile devices
  • [x] Generate Lighthouse report for desktop devices
  • [x] Post screenshots of results in this issue's comments section
  • [x] Write brief summary of audit highlights, including Lighthouse's recommendations for improvement

Additional context

  • For instructions on using Lighthouse, see https://developer.chrome.com/docs/lighthouse/overview

CodeWritingCow avatar Jul 09 '24 03:07 CodeWritingCow

Hi, can I be assigned this ticket pls? Thx.

zheyichn avatar Jul 11 '24 16:07 zheyichn

@zheyichn assigned!

bacitracin avatar Jul 11 '24 16:07 bacitracin

Lighthouse report for mobile devices

  • Performance score was 74/100, affected by Largest Contentful Paint of 6.3 seconds.
  • Accessibilty score was 95/100. The penalty came from aria-* attribute does not match their roles, which is mentioned in #727 too.
  • SEO score was 91/100 due to links on page are not crawlable.

Screenshoots

a11y-mobile-1

a11y-mobile-2

a11y-mobile-3

a11y-mobile-4

a11-mobile-5

zheyichn avatar Jul 11 '24 20:07 zheyichn

Lighthouse report for desktop devices

  • Performance score was 97/100, affected by Largest Contentful Paint of 1.2 seconds.
  • Accessiblity score was 95/100 because mismatch of aria-* attribute and their roles, which is also mentioned #727.
  • SEO score was 91/100, as links are not crawlable.

Screenshots

a11y-desk-1

a11y-desk-2

a11y-desk-3

a11y-desk-4

a11y-desk-5

zheyichn avatar Jul 11 '24 20:07 zheyichn

Summary

  • Performance gets penalty from long image loading time.
  • Accessiblity is good (95/100) on both devices. Points deducted from misue of aria-* attribute on
  • SEO requires links to be crawlable.

Improvement recommendations

For both mobile devices & desktop devices

  1. Explore how to reduce image loading time. (Performance)
  2. Resolve the aria-* mismatch with role issue of the menu button, possibily by refactoring the menu component as discussed in #727. (Accessibility)
  3. Make links crawlable to search engines. (SEO)

zheyichn avatar Jul 11 '24 20:07 zheyichn

@zheyichn thanks for digging into this. This page has room for improvement on mobile devices. Based on your recommendations, I will create an issue for exploring how to reduce image loading time on this page.

Our SEO score is good on this page (in the 90s). For now, let's prioritize improving page load time because that will benefit our site users more.

CodeWritingCow avatar Jul 11 '24 21:07 CodeWritingCow

@zheyichn I noticed these two recommendations from Lighthouse: "Reduce unused JavaScript" and "Reduce unused CSS." Did the Lighthouse report have details on what JS and CSS can be removed from the page?

CodeWritingCow avatar Jul 15 '24 05:07 CodeWritingCow

Hi @CodeWritingCow , the report didn't directly point out unused code. I tried navigating to the Coverage tab, and it semed to display some compiled CSS/JS code. Do you know how I can trace back to lines of code in our codebase?

unused_javascript unused-css

zheyichn avatar Jul 15 '24 19:07 zheyichn

Additionally, I looked into how to reduce logo image loading time. The delay mostly came from render delay, meaning rendering is blocked after image resource was loaded. I found some suggestions on how to improve this, which require cleaning CSS and JS code, or splitting CSS code into smaller files.

  • https://web.dev/articles/optimize-lcp
  • https://developer.chrome.com/docs/lighthouse/performance/render-blocking-resources#how_to_eliminate_render-blocking_scripts
render-delat

image

To ensure the render delay was caused by large stylesheets, I ran Lighthouse on locally served a11y page with global.css removed. And it indeed stopped complaining about LCP as the screenshoot below shows. @CodeWritingCow Do you think this is the right direction to work towards - clean up CSS/JS code? I'm still trying to figure out how to identify unused code blocks for each page precisely. Thanks.

css-removed-LCP

zheyichn avatar Jul 15 '24 19:07 zheyichn

Hi @zheyichn, generally we would use source maps during development to trace compiled code back to the original code. However, Next.js apps disable source maps in production by default.

As a workaround, try running Lighthouse in localhost. The Coverage tab should show uncompiled CSS/JavaScript code.

I like your ideas of cleaning up unused CSS/JS code, and splitting some CSS into smaller files. Definitely worth exploring further. For example, globals.css has many styling rules for maplibregl, but only the Find Properties page needs those rules. Other pages shouldn't have to load those rules.

CodeWritingCow avatar Jul 16 '24 04:07 CodeWritingCow