The first thing a reader sees in a practice quiz should be the situation they came to work through. A loading screen followed by an account prompt is a poor place to ask someone to try a conversation coach. And a screenshot-based demo asks for a real conversation before the reader knows what they’ll get back.
Hitchens AI’s public practice page starts with fictional conversations and sends the explanations as HTML. With JavaScript, readers get selectable replies, feedback for each choice, and a guided tour through nine cases. If the script fails, they can still read every chat and expand its suggested reply. Here’s a one-card version you can adapt for any practice worksheet.
Put the exercise and its explanation in HTML
Save this as practice.html and open it in a browser. The example adapts the exact busy-match scenario from the site. The script is inline here so you can remove it and try the fallback. The site loads its quiz script separately with defer.
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Practice one reply</title>
<main>
<h1>What would you say?</h1>
<article id="quiet-week" aria-labelledby="quiet-title">
<h2 id="quiet-title">A busy week or a dry reply?</h2>
<p>Your match says <q>ugh still at work. will text later</q></p>
<div id="choices" hidden>
<button type="button" aria-pressed="false"
data-feedback="They’re busy. Another question gives them something else to answer.">
did you end up going to that café?
</button>
<button type="button" aria-pressed="false"
data-feedback="You acknowledged the moment and gave them room to come back.">
oof. hope you get out of there soon
</button>
<p id="feedback" role="status"></p>
</div>
<details id="debrief">
<summary>Suggested reply and why</summary>
<p>“oof. hope you get out of there soon” acknowledges what they said.
They can return to the chat when their shift ends.</p>
</details>
</article>
</main>
<script>
const choices = document.querySelector('#choices');
const buttons = choices.querySelectorAll('button[data-feedback]');
const feedback = document.querySelector('#feedback');
const debrief = document.querySelector('#debrief');
for (const button of buttons) {
button.addEventListener('click', () => {
for (const option of buttons) {
option.setAttribute('aria-pressed', String(option === button));
}
feedback.textContent = button.dataset.feedback;
debrief.open = true;
});
}
choices.hidden = false;
</script>
</html>
The important order is to attach the handlers, then reveal the choices. The HTML hides controls that need JavaScript, while the browser handles the native disclosure and keyboard interaction with <summary>. Feedback goes to a status region so choosing an answer doesn’t have to move keyboard focus.
Give each case an address
An id like quiet-week lets someone link to an individual case. Keep the IDs stable as you edit or reorder your questions. In the full quiz, the script looks at location.hash before picking the first card to show. Someone following a topic link can start in the middle, and someone opening the page without the script still gets native fragment navigation. Try the busy-match case in the full quiz.
For several cards, store text, options, and explanations in one content file and generate the markup at build time. Escape strings before inserting them into HTML, including feedback embedded in attributes. In the browser, assign feedback with textContent. Hitchens keeps the set of tried cases in memory, so progress resets on reload. Selecting an answer needs zero requests to a model or a quiz service.
Three checks before publishing
- Remove the script and open
practice.html#quiet-week. The example and its expandable explanation should still work. - Restore the script. Use Tab and Enter to try both choices. The feedback should change without moving you away from the active button.
- Reload with the case fragment in the URL. Confirm that it points to the same example. For a guided multi-card version, check the initial card and the topic links after reordering your content.
This article was drafted with AI assistance. The example is based on the Hitchens AI browser practice implementation.
Top comments (0)