Build Your Own Web

Build this website with blocks

Try another way to build: snap together HTML, CSS and behavior blocks, change their fields, and watch your website update. Start with this lesson’s project or try a code example below.

Want to keep what you build? Web Studio holds a drawing, blocks and code in one project that you can share on the class site and publish as your own website.

Lesson 5 · 50–65 minutes · After JavaScript

Make it work for someone else.

A page that looks right on your laptop is the beginning of testing, not the end of it. Learn to find a broken link, repair a JavaScript error, and make your site usable with a keyboard and a narrow screen.

Finish line: your foundation website passes a written test plan, and you can show one before-and-after repair you can explain.

1. Make a bug report you can act on

Continue with your saved folder from the JavaScript lesson. Create a file called test-notes.md beside index.html. Record exactly how to reproduce each problem. "It is broken" tells a future you nothing; "the search shows every project when I type a word with a capital letter" tells you where to look.

# Website test notes

Browser and screen size:
Page / feature:
Steps to reproduce:
Expected result:
Actual result:
First useful error or failed request:
Change I made:
Result after saving and refreshing:
Do: search your project list for a title that exists, then for a word that does not. Check: matching projects appear, the empty result explains itself, and clearing the search restores everything. Repair: confirm the query is trimmed and compared in the same case as the project titles.

2. Follow the evidence in DevTools

  1. Open your site, right-click a visible project title, and choose Inspect. Find that element in the browser's element tree.
  2. Change its text or a colour in the inspector, then refresh. The change disappears, because you edited the browser's copy of the page and not your saved source. This is the single most common source of lost work.
  3. Open the Console. Refresh before reproducing the bug so the error list is clean, then read the first relevant error and the filename and line number beside it.
  4. Open the Network panel and reload. A missing script or image points at a path, a spelling, or a filename-case problem. Serving the page through a local server makes the HTTP status codes visible.
  5. Make the repair in VS Code, save, reload, and repeat your original steps. Then test a second input, because one passing case is not evidence.

VS Code Debugging Superpowers: In VS Code, install the free Error Lens extension to highlight syntax typos inline before you even switch to the browser. Use Ctrl+D (Mac: Cmd+D) to highlight and rename mismatched IDs or class selectors across multiple lines simultaneously without manual retyping! See the Mastering VS Code Guide for more tools.

Ask the right question first

SymptomFirst place to look
Image missingNetwork request and the src path
Style ignoredComputed styles, and crossed-out declarations in the inspector
Button does nothingConsole, then the selector, then script loading order
Sideways scrollingFixed widths and over-wide children in the element inspector
Old content keeps appearingCache — do a hard reload

These panels inspect different layers of the same page. See MDN's guide to browser developer tools.

Grace Hopper's Harvard Mark II computer logbook page from September 9, 1947 with a moth taped inside
The First Computer Bug Logbook (Grace Hopper, 1947) The origin of “debugging.” When the electromechanical Harvard Mark II computer malfunctioned at Harvard University, operators traced the failure to an actual moth trapped between the contacts of Relay #70. Team leader Grace Hopper taped the insect into the logbook with the entry: “First actual case of bug being found.” DevTools debugging carries on this core discipline of isolating the exact root cause of an error rather than guessing. Credit: US Naval Historical Center / Smithsonian / Wikimedia Commons · Public domain · source
Author and activist Helen Keller using a specialized braille typewriter
Helen Keller with Braille Typewriter (Accessible Authoring) Author and advocate Helen Keller typing on a specialized Braille writer. Keller demonstrated that tactile and keyboard-based communication enables full intellectual participation when tools provide accessible affordances. In web development, designing keyboard-navigable routes and semantic screen reader cues ensures the web remains open to everyone. Credit: Library of Congress / Wikimedia Commons · Public domain · source

3. Repair one cause at a time

Copy this deliberately broken example into a separate file called debug-practice.html. Open it and read the Console. A null value means the selector did not find an element — so the code asked for something that is not on the page.

<!-- Broken example: the ID and the selector disagree. -->
<button id="show-projects" type="button">Show projects</button>
<p id="project-status" aria-live="polite"></p>
<script>
  const button = document.querySelector("#show-project");
  button.addEventListener("click", () => {
    document.querySelector("#project-status").textContent = "Three projects ready.";
  });
</script>

Which edit repairs the cause?

The button's ID is show-projects. The selector asks for #show-project. Choose the repair, then test the restored demo.

Choose an edit and explain what it changes.

The demo cannot run until its selector is repaired.

Check in your own file: the Console error is gone and clicking shows the message. Explain: the repair makes the selector match a real element. Changing decoration cannot fix a missing element reference, and waiting longer cannot conjure one — the two wrong answers are wrong for different reasons, and naming those reasons is the skill.

4. Design a route for the keyboard

Put your mouse aside. Reload and press Tab repeatedly. Can you see which link, button, or field has focus? Can you activate it with the key you would expect? Use a link to go somewhere and a button to do something — swapping them breaks the keyboard behaviour people rely on.

Add visible focus in style.css

:focus-visible {
  outline: 3px solid #2455a6;
  outline-offset: 4px;
}
/* Keep the browser's focus outline unless you replace it
   with something at least as visible. Never just remove it. */

Check the outline against your own background. If it disappears, choose a colour that contrasts with it. Do not rely on hover alone to reveal a control someone needs.

Give every field a real label

<label for="project-search">Search projects</label>
<input id="project-search" type="search">
<p id="results" aria-live="polite"></p>

The label's for must match the input's id. Placeholder text is a hint, not a label — it vanishes as soon as someone types. Use headings to structure the page, and write alt text that carries the information the image carries. Decorative images take alt="".

Check your markup choices against W3C page structure and form labelling.

Refreshable Braille display terminal with mechanical pins forming tactile characters
Refreshable Braille Display (Tactile Screen Reader Interface) A refreshable Braille display terminal. Electromechanical pins raise and lower dynamically to transcribe text, headings, and form labels as a blind user navigates the browser's accessibility tree. When developers use semantic HTML (<nav>, <label for="...">, <h1>–<h6>), assistive devices convert those tags into tangible orientation cues. Credit: Wikimedia Commons · CC BY-SA 3.0 · source
The Optacon tactile reading device with handheld optical camera and tactile finger array
The Optacon: Optical-to-Tactile Reading Machine (1971) Developed by John Linvill and James Bliss at Stanford University, the Optacon (“OPtical-to-TActile CONverter”) used a miniature handheld camera with a 24×6 phototransistor array connected to a tactile finger array. Each vibrating reed corresponded to a dark pixel on paper or an early CRT terminal, allowing blind users to read printed books and early computer displays directly through their index fingertip. Credit: Liftarn / Wikimedia Commons · CC BY-SA 3.0 · source

5. Stress-test your layout and content

  1. Narrow screen. Use the responsive view in DevTools at 375px wide and read top to bottom. The page itself must not scroll sideways. A wide code block or table may scroll inside its own box — that is different.
  2. Long content. Replace a short project title with a much longer one. It should wrap, not cover a control or push the layout apart.
  3. Zoom. Zoom to 200%. Navigation, labels, and buttons must all still be usable.
  4. Missing media. Temporarily break an image's path. Does the alt text explain what is missing? Restore the path afterwards.
  5. Without motion. No important instruction should depend on an animation, and nothing should start playing sound on its own.
  6. Colour. Check text and background contrast with an accessibility checker, and make sure states are communicated by words or shapes as well as by colour.
A tool cannot finish the review for you. Automated checks catch some defects. Reading the page, operating it with a keyboard, and watching another person try to complete a task each reveal problems the others miss.
Ishihara color blindness test plate displaying dotted circles with embedded numbers
Dr. Shinobu Ishihara's Color Perception Plate (1917) The worldwide standard for diagnosing red-green color deficiency. Sighted people with standard color vision read one number, while individuals with protanopia or deuteranopia read a different number or none at all. In web design, WCAG contrast standards require at least 4.5:1 text contrast and prohibit relying on color alone to communicate state or errors. Credit: Dr. Shinobu Ishihara / Wikimedia Commons · Public domain · source
Christopher Sholes 1873 typewriter mechanism with mechanical key levers and platen
Christopher Sholes' 1873 Typewriter (The Physical Keyboard Route) Christopher Latham Sholes invented the first commercially successful typewriter in 1873, introducing the QWERTY keyboard layout. Keyboard-only navigation on the modern web honors this 150-year-old input paradigm: every interactive link, button, and form control must be fully navigable via Tab, Enter, and arrow keys without requiring a mouse. Credit: George Iles / Wikimedia Commons · Public domain · source

6. Your release rehearsal

Ask a partner to find a project, open it, and get back to the home page. Watch in silence — every hint you give hides a real defect. Write down the first moment of confusion, fix that one thing, then ask them to repeat the task. Keep both observations in test-notes.md; the pair of them is your evidence that the change helped.

Choose an extension