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.
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: 2. Follow the evidence in DevTools
- Open your site, right-click a visible project title, and choose Inspect. Find that element in the browser's element tree.
- 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.
- 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.
- 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.
- 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
| Symptom | First place to look |
|---|---|
| Image missing | Network request and the src path |
| Style ignored | Computed styles, and crossed-out declarations in the inspector |
| Button does nothing | Console, then the selector, then script loading order |
| Sideways scrolling | Fixed widths and over-wide children in the element inspector |
| Old content keeps appearing | Cache — do a hard reload |
These panels inspect different layers of the same page. See MDN's guide to browser developer tools.
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.
<nav>, <label for="...">, <h1>–<h6>), assistive devices convert those tags into tangible orientation cues. Credit: Wikimedia Commons · CC BY-SA 3.0 · source
5. Stress-test your layout and content
- 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.
- Long content. Replace a short project title with a much longer one. It should wrap, not cover a control or push the layout apart.
- Zoom. Zoom to 200%. Navigation, labels, and buttons must all still be usable.
- Missing media. Temporarily break an image's path. Does the alt text explain what is missing? Restore the path afterwards.
- Without motion. No important instruction should depend on an animation, and nothing should start playing sound on its own.
- 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.
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
- Add a skip link to your main content and test it with the keyboard alone.
- Introduce a deliberate filename-case mismatch, diagnose it from the Network panel, and write down why a web host will expose it when your laptop did not.
- Test your site in a second browser and compare your evidence against the first.