Rock Paper Scissors Lizard Spock: Svelte 5, Tailwind v4, Playwright

Solution retrospective
I'm most proud of the tests: 218 Playwright tests and 7 unit tests, written from a spec before the code. They replace Math.random in the page to choose the house's sign and drive the page's clock, so every game of the designs is replayed exactly (same signs, same score) and the 22 screens differ from the JPG designs by 0.6–3.1 %. The games are played to the end with the mouse and with the keyboard alone at 375, 768 and 1440 px, and with a finger on a phone.
Next time, I'd run the keyboard tests against the live site several times from the start. Two timing bugs around the rules dialog only showed up there: closing then reopening it quickly, and focus jumping back to the Rules button after it had already moved.
What challenges did you encounter, and how did you overcome them?- Triangle and pentagon that keep their shape: the board is a container; each token's position and size are percentages of its width in container query units (
cqi), read from the designs, so the whole board shrinks as one below 375 px. Every part of a token (edge, disc, icon, hover ring, halos) is a fraction of its diameter, so one component works at five sizes. - The rules dialog: a modal
<dialog>is pinned to the top and bottom of the screen, soblock-size: autostretched it to the full height;fit-contentwith amax-block-sizekeeps its size and lets it scroll in a short window. The dialog also closes at once on Escape, the close button or the backdrop, instead of waiting for the browser'scloseevent, which arrives later. - What the designs leave open: a draw, switching between the two versions, negative scores and the timing of the reveal are not drawn. A draw reuses the result layout with "Draw" and no halos; a "Lizard-Spock" / "Original" button sits next to Rules at step 1 only; each version keeps its own score in
localStorage. - Contrast: the rules diagram's "BEATS" labels and arrows were 2.1:1 and the close icon 1.5:1; the diagram is inlined with
#6b7087(4.9:1), the icon is drawn in the dark navy, and the rules are also given as text to screen readers.
- The result is announced in a status region ("You picked Paper, the house picked Rock: you win. Score 13") and focus moves to Play Again. Is that enough with a screen reader, or would you also move focus to the result heading?
- During the reveal (steps 2 and 3), the chosen sign is no longer a button, so focus moves to the game area (
tabindex="-1"). Would you handle focus differently while the house is picking? - The version switch is not in the designs; I placed it next to Rules and show it at step 1 only. Would you put it somewhere else, or keep it visible during a game?
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on Koya Esdras’s solution.
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord