Performance and Accessibility Optimization

Session Time: 120 minutes


Table of Contents

  1. Analyzing Front-End Performance
  2. Accessibility Compliance and WCAG
  3. AI-Assisted Auditing and Reporting
  4. Lab: Auditing for Speed and Inclusion
  5. Wrap-Up and Reflection

Learning Objectives

Upon completion of this session, participants will be able to:

  • Analyze front-end performance metrics using browser tools.
  • Evaluate accessibility compliance using WCAG guidelines.
  • Utilize AI to summarize and recommend optimizations.

Session Breakdown

Segment Topic Duration (minutes)
Concept I Front-End Performance Metrics 40
Concept II Accessibility & WCAG Guidelines 30
Practical Lab Lab: Auditing for Speed and Inclusion 50
Total 120 minutes

1. Analyzing Front-End Performance

Learning objective: Analyze front-end performance metrics using browser tools.

A fast website retains users. Performance isn't just about "feeling" fast; it is measured by specific metrics tracked by the browser.

The Cost of Slow Performance

Users expect pages to load in under 2 seconds. Slow sites lead to:

  • Higher bounce rates (users leaving immediately).
  • Lower search engine rankings (SEO).
  • Frustration for users on mobile networks.

Key Metrics: Core Web Vitals

Google defines three "Core Web Vitals" that are critical for user experience:

  1. LCP (Largest Contentful Paint): How long it takes for the main content (like a hero image) to load.
    • Target: Under 2.5 seconds.
  2. FID (First Input Delay): How long it takes the page to respond when a user clicks a button.
    • Target: Under 100 milliseconds.
  3. CLS (Cumulative Layout Shift): Does the layout jump around while loading? (e.g., an ad pops in and pushes text down).
    • Target: Score of less than 0.1.

Tools for Measurement

The primary tool for this is Lighthouse, built directly into Chrome DevTools.

  1. Open DevTools -> Click the Lighthouse tab.
  2. Select "Navigation" and check "Performance."
  3. Click "Analyze page load."

2. Accessibility Compliance and WCAG

Learning objective: Evaluate accessibility compliance using WCAG guidelines.

Accessibility (a11y) means making websites usable by everyone, including people with disabilities (visual, motor, auditory, or cognitive).

The WCAG Guidelines

The Web Content Accessibility Guidelines (WCAG) are the global standard. They are organized around four principles (POUR):

  1. Perceivable: Information must be presented in a way users can perceive (e.g., Alt text for images, captions for video).
  2. Operable: Users must be able to navigate the interface (e.g., Keyboard-only navigation, no trapping the cursor).
  3. Understandable: Information and operation must be clear (e.g., Consistent navigation, clear error messages).
  4. Robust: Content must be robust enough to work with current and future user agents (e.g., Screen readers).

Common Accessibility Failures

  • Low Contrast: Gray text on a white background that is hard to read.
  • Missing Alt Text: Screen readers cannot describe an image without it.
  • Empty Links: Buttons that just contain an icon with no text description.

3. AI-Assisted Auditing and Reporting

Learning objective: Utilize AI to summarize and recommend optimizations. Integrate AI to generate checklists and summarize audit results.

Performance and accessibility reports can be dense and technical. AI serves as an excellent assistant for interpreting these reports and creating actionable plans.

Generating Checklists

Instead of manually listing every requirement, you can ask AI to generate a checklist based on your specific project features.

Prompt Example:

"I am building a contact form with name, email, and a 'submit' button. Create a WCAG accessibility checklist specifically for this form, focusing on keyboard navigation and error handling."

Summarizing Audit Results

When Lighthouse gives you a long list of issues, you can paste the text into an AI to prioritize it.

Prompt Example:

"Here is my Lighthouse performance report. It mentions 'Render-blocking resources' and 'Unused CSS'. Can you explain what these mean in simple terms and rank them by which one will give me the biggest speed boost if I fix it?"


4. Lab: Auditing for Speed and Inclusion

Learning objective: Test your website’s performance and accessibility using browser tools. Use AI to create an optimization plan and manually implement measurable improvements.

Overview

In this lab, you will perform a "Health Check" on a provided sample website (or your own portfolio). You will identify slow-loading assets and accessibility barriers, then fix them.

Part 1: Establishing a Baseline

  1. Open the target website in Chrome.
  2. Open DevTools and go to the Lighthouse tab.
  3. Check both Performance and Accessibility.
  4. Run the audit.
  5. Record your scores: (e.g., Performance: 65, Accessibility: 80).

Part 2: AI-Generated Optimization Plan

  1. Copy the top 3 specific error messages from the Lighthouse report.
  2. Prompt your AI Assistant:

    "I ran a Lighthouse audit and got these three errors: [Paste Errors]. Create a step-by-step optimization plan for a beginner developer to fix these. Explain why these fixes improve the user experience."

  3. Read the AI's explanation. It might suggest compressing an image, adding a <label> to an input, or changing a text color.

Part 3: Implementation and Retesting

  1. Fix the Issues: specific Go into your code and apply the changes suggested by the AI (e.g., run your images through an optimizer, add alt="..." tags).
  2. Retest: Run Lighthouse again.
  3. Compare: Did your score go up?

Deliverable: The Optimization Report

Create a short document (or commit message) summarizing your changes:

  • Before/After Scores: (e.g., "Performance improved from 65 to 90").
  • Key Fixes: Briefly describe two major changes you made.
  • AI Insight: Include one piece of advice the AI gave you that helped clarify a technical term.

5. Wrap-Up and Reflection

Discussion Questions:

  1. Why is "Perceived Performance" (how fast it feels) sometimes more important than the actual load time?
  2. If a site scores 100% on an automated Accessibility audit, is it guaranteed to be perfectly accessible? (Hint: Can a computer judge if an alt text description makes sense?)
  3. How did the AI help you prioritize which bugs to fix first?

Resources