🚧 Under construction — VoTechWorks is being built. A free tech program — complimentary, as our commitment to get America working.
voTechWorksGrade 13 · a vocational technology learning center, by urbanicity
newSchoolWorks.com › VoTechWorks › Technology & Design › Web & Software Development › HTML, CSS, and JavaScript for Web Development › Lesson 11
TEC-WEB46-02 · Lesson 11 · 14 clock hours · demo

Browser Developer Tools, Debugging, and Accessibility Auditing

Objective. Students use browser DevTools to set breakpoints, step through JavaScript execution, inspect and edit CSS live, analyze network requests, and run a Lighthouse accessibility and performance audit.

⚠ Pending professional review

This lesson, its worked examples and its practice questions has not yet been verified by an industry-certified professional or by a certification or approval body. It is a study draft and may contain errors. Do not use it as instructions for work on a job site or on live equipment. Always follow your instructor, your supervising professional, and current official references and regulations.

VoTechWorks program approval and accreditation are still in progress. Credentials are issued only by the certifying bodies named in each program, after their own exams.

Browser Developer Tools: Your Daily Workshop

Every modern browser ships with a built-in set of diagnostic tools called DevTools. In Chrome, open them with F12 or right-click any element and choose Inspect. Firefox DevTools work almost identically and serve as a useful cross-browser check. DevTools are non-destructive when used in the browser window—changes you make there do not touch your actual files unless you copy them out. Always save your working edits to a permanent stylesheet or script before closing the browser.

The Sources Panel: Debugging JavaScript

The Sources panel is where you debug JavaScript. It shows all scripts loaded by the page and lets you pause execution at any line using breakpoints. Click the line number in the Sources panel to set a breakpoint. When the browser reaches that line, execution pauses and you can inspect the current value of every variable in scope.

Once paused, use the four control buttons:

The Scope pane on the right shows local and global variables live. Hover over any variable in the code to see its current value. The Call Stack pane shows which functions called each other to reach the current point—useful when a bug originates several levels deep.

Three common bug types you will encounter:

1. Undefined variable reference — a variable is used before it is declared or is misspelled. The console shows `ReferenceError`. Set a breakpoint before the error line and check variable names in the Scope pane.

2. Incorrect selector — `document.querySelector()` returns `null` because the CSS selector does not match any element. Log the return value or hover over it while paused.

3. Off-by-one loop error — a loop runs one iteration too many or too few, often because `<` was written as `<=` or the starting index is wrong. Step through the loop iteration by iteration to watch the index variable change.

Always add a brief code comment explaining what the bug was and how you fixed it. Comments serve as documentation for yourself and teammates.

The Elements Panel: Live CSS Editing

The Elements panel shows the live DOM tree on the left and the CSS rules for the selected element on the right. Click any element in the panel, then edit property values directly in the Styles pane. You can:

All edits are temporary. As soon as you reload the page they disappear. When you reach the target appearance, use the Changes drawer (three-dot menu → More tools → Changes) or simply copy the rule text and paste it into your external `.css` file.

The Network Panel: Analyzing Requests

The Network panel records every HTTP request the browser makes—HTML, CSS, JavaScript, images, fonts, API calls. Key columns to read:

Filter by type (JS, CSS, Img) to focus on one category. Click any request row to see its Headers, Preview, and Timing breakdown.

Lighthouse: Accessibility and Performance Auditing

Lighthouse is an automated auditing tool built into Chrome DevTools (also available as a CLI). Open the Lighthouse tab, choose the categories you want (Performance, Accessibility, Best Practices, SEO), select Mobile or Desktop, then click Analyze page load. Lighthouse loads the page in a controlled environment, measures dozens of metrics, and returns a score from 0 to 100 for each category.

Performance scores reflect metrics such as Largest Contentful Paint (how long until the main content is visible) and Total Blocking Time (how long scripts block user interaction). Common issues include unoptimized images, render-blocking scripts, and large JavaScript bundles.

Accessibility scores are based on the WCAG (Web Content Accessibility Guidelines) checklist. Common flags include missing `alt` text on images, insufficient color contrast between text and background, form inputs without associated labels, and missing landmark roles.

For each flagged issue, Lighthouse explains why it matters and links to documentation. When you write your action list, state the issue, the element or file it affects, and the specific fix—for example, "Add `alt="Company logo"` to the `<img>` tag in the header" is actionable; "fix images" is not.

Accuracy and Safety Notes

DevTools edits live only in memory. Never assume a browser-side change has been saved. Before closing a session, copy all working CSS or JS edits into your source files and verify the page still works after a hard reload (Ctrl+Shift+R). When sharing screenshots of audit results, include the URL and date because scores change as the page or Lighthouse versions change. Accessibility is not optional—WCAG compliance is referenced in US federal accessibility law, so treating audit findings as real defects to fix, not suggestions to ignore, is professional practice.

Key terms9

BreakpointA marker set on a specific line in the Sources panel that causes the browser to pause JavaScript execution when that line is reached, allowing variable inspection.
Call StackA pane in DevTools that lists the chain of function calls that led to the currently paused line of code, read from bottom (oldest) to top (most recent).
DOM (Document Object Model)The browser's live, in-memory tree representation of an HTML page; the Elements panel displays and lets you edit the DOM directly.
LighthouseAn open-source, automated auditing tool built into Chrome DevTools that scores a web page on Performance, Accessibility, Best Practices, and SEO.
Largest Contentful Paint (LCP)A performance metric that measures how long it takes for the largest visible content element (often a hero image or headline) to finish rendering in the viewport.
WCAG (Web Content Accessibility Guidelines)A set of internationally recognized guidelines, published by the W3C, that define how to make web content accessible to people with disabilities.
Step OverA debugger control that executes the current line and moves to the next line in the same function, without descending into any function called on that line.
ReferenceErrorA JavaScript runtime error thrown when code attempts to use a variable that has not been declared or is out of scope.
Network panelA DevTools tab that records and displays every HTTP request and response made during a page load, including status codes, file sizes, and timing.
In class: Debugging walkthrough: instructor introduces a page with three planted JavaScript bugs (undefined variable reference, incorrect selector, off-by-one loop error); students use the DevTools Sources panel to set breakpoints, step through execution, and identify and fix each bug on their own machines. · Live CSS editing challenge: students open a provided URL in Chrome, use the DevTools Elements panel to live-edit CSS so the page matches a target screenshot (color, font size, spacing), then copy the working CSS into a permanent stylesheet. · Lighthouse audit lab: students run Lighthouse on their Lesson 6 responsive page, screenshot and interpret the Accessibility and Performance scores, identify the top two issues flagged in each category, and write a prioritized action list in the lab log.
Materials: Chrome DevTools (Sources, Elements, Network, Lighthouse tabs), Firefox DevTools as alternate reference, MDN Debugging JavaScript guide, provided buggy page files, Lighthouse documentation (developer.chrome.com)
Check: All three bugs identified and fixed with correct explanations in code comments; Lighthouse action list contains at least four distinct actionable items with correct interpretation of the audit findings; pass mark all three bugs fixed plus action list complete.

Practice check8

Answer each question, then check it. Nothing is recorded; this is your own practice.

Web development tools and debugging
1. A student sets a breakpoint on line 14 of a script and clicks Resume. Where will execution pause next?
Web development tools and debugging
2. While debugging, the Scope pane shows a variable named `userInput` has the value `undefined`. What is the most likely cause?
Web development tools and debugging
3. A student uses `document.querySelector('.nav-bar')` but the function returns `null`. What is the most efficient DevTools step to diagnose the problem?
Web development tools and debugging
4. A loop is written as `for (let i = 0; i <= items.length; i++)`. What type of bug is this, and what is the correct fix?
Web development tools and debugging
5. After live-editing CSS in the Elements panel to match a target screenshot, the student reloads the page and all changes disappear. What should the student have done?
Web development tools and debugging
6. In the Network panel, a student sees an image request with status code 404. What does this mean?
Web accessibility (WCAG / Lighthouse)
7. A Lighthouse accessibility audit flags 'Image elements do not have [alt] attributes.' Which action correctly resolves this issue?
Web performance and Lighthouse auditing
8. A student's Lighthouse Performance score is low and the report highlights a very high Largest Contentful Paint (LCP). Which of the following is a direct, actionable fix for a slow LCP caused by a hero image?
Record this lesson on my transcript. Sign in with your key and enrollment email to record lessons (enroll free if you have no key). This page stays open to read and practise.