Five tools sit on our marketing site and none of them have a backend. That was a deliberate decision and I have written about it before as a win: nothing is uploaded, there is no account, no request leaves the browser. This week I audited what that decision costs, and the answer is sharper than I expected. Because nothing leaves the browser, nothing can be addressed either. None of the five tools can be linked to in a configured state, and none of them survive a reload.
Here is the audit. All numbers are from the HTML the site actually serves and from a real browser session on it.
The five tools, as markup
| tool pages | 5 |
| component lines behind them | 1,072 |
| form controls in the delivered HTML | 32 |
<form> elements on all 79 pages of the site | 0 |
autocomplete attributes | 0 |
required attributes | 0 |
pattern attributes | 0 |
| inputs that handle the Enter key | 1 of 25 |
Broken down, the 32 controls are 21 type="number", 7 select, 3 text inputs with no type attribute at all, and 1 type="time". The number inputs do carry min and max, which is the only validation anywhere in the set:
<input type="number" id="rounds" min="1" max="12" value="6"> <input type="number" id="questions" min="1" max="20" value="10"> <input type="number" id="teams" min="1" max="40" value="12"> Those are the three fields on the answer sheet generator. The bounds exist because a typo should not be able to ask for a 900-page PDF, and they are also enforced a second time in the change handler, because min and max on a number input do nothing at all when the user types rather than clicks the spinner.
Zero forms, and ten buttons that think otherwise
There is not a single <form> element on the public site. 79 pages, 96 buttons, no form. The buttons split in a way worth knowing about:
| buttons in the delivered HTML | count |
|---|---|
with type="button" | 86 |
with no type attribute | 10 |
All ten of the untyped ones are our shared Button component, used by four of the five tools. Our component spreads props onto a <button> and never sets a default type, so React emits no attribute and the DOM applies the HTML default:
document.querySelectorAll('button')[1].type // "submit" Today that is inert, because a submit button with no form submits nothing. It becomes a bug the first time somebody wraps one of these tools in a <form> for the keyboard behaviour: every "remove this round" button on the round planner would start submitting the page. Seven of the ten are exactly that button.
The keyboard story also explains itself from the same table. One input out of 25 handles Enter, and it does so with its own key handler:
onKeyDown={(event) => { if (event.key === "Enter") generate() }} That is the web address field on the QR code tool, where pressing Enter does draw the code. Press Enter anywhere in the other four tools and nothing happens, because the thing that would normally give you that for free, implicit form submission, needs a form.
Nothing is stored, including by us
Measured on each of the five tool pages after loading them:
localStorage keys | 0 |
sessionStorage keys | 0 |
| query string | empty on all five |
| fragment | empty on all five |
| state containers in the code | useState only |
So every decision a visitor makes lives in a React hook and nowhere else. Which produces this, measured live:
| tool | I set | after a reload |
|---|---|---|
| answer sheet generator | 12 rounds, 20 questions, 40 teams | 6, 10, 12 |
| profit calculator | 140 teams | 10 |
| round planner | start 00:00, finish 01:41 | 20:00, finish 21:41 |
| team name generator | ten drawn names | ten different names |
The URL never changed during any of it. The round planner is the one that stings: you pick six round types, set the questions in each, move the break, settle on a start time, and the result is a running order you would reasonably want to send to the person hosting on the night. There is nothing to send. The page you are looking at and the page you would link them to are the same URL in two different states, and only one of those states exists.
The fix is the fragment, not the query string
The obvious move is to put the state in the URL, and the obvious implementation is a query string. That one is wrong here, and for an interesting reason: a query string is sent to the server. It lands in CDN logs, it appears in the Referer header on outbound clicks, and it would quietly make "nothing you type here leaves your browser" false for a site whose tools pages say exactly that.
A fragment is never sent. It is the one part of a URL the browser keeps to itself, which makes it the correct carrier for state that must stay on the visitor's machine and still be copyable into a message.
The amount of state involved is tiny. The round planner holds a start time, a break length, a break position and a list of rounds, each a type and a count:
/tools/round-planner#20:00,15,3,s10,m10,s10,p10,l10,q10 Thirty-six characters for the whole plan. The answer sheet generator needs four values, the profit calculator ten numbers and a currency symbol. history.replaceState on change, parse on mount, and every one of these tools becomes something a host can bookmark, re-open and paste into a WhatsApp group, with no server, no account and no cookie, exactly as advertised.
There is also a selfish reason to want it. We have nineteen guides that explain how to run a quiz night, and they link to the tools as tools. A guide about how many rounds a quiz should have could instead link to the planner already loaded with a six-round evening, which is a different and much better kind of link: not "here is a calculator", but "here is the answer, adjust it".
Check it yourself
Open the round planner, change the start time, watch every clock in the running order move, then look at the address bar. It still says /tools/round-planner. Reload and you are back at 20:00.
// paste in the console on any of the five tool pages ({ forms: document.forms.length, controls: document.querySelectorAll('input,select,textarea').length, stored: Object.keys(localStorage).length + Object.keys(sessionStorage).length, url: location.search + location.hash }) // { forms: 0, controls: 15, stored: 0, url: "" } If you build client-only tools, that last field is the one to look at. forms: 0 is a design choice with consequences for the keyboard. url: "" is a design choice with consequences for whether anybody can ever show your tool to somebody else.