The attributes that decide what a phone shows when somebody taps a field never come up in code review. They are not visible on a laptop, they do not break a test, and they are the difference between a numeric keypad and a full QWERTY with a comma on the wrong layer. So I counted all of them in Nakodo.
The inventory
90 input and textarea tags across 582 source files. 14 are hidden inputs carrying state through a form, so 76 are fields a person can type into, and they live where you would expect: 50 behind the login, 14 in the admin panel, five on the sign-in and sign-up pages, two on public pages, plus the two primitives themselves.
The remarkable part is how few raw elements there are. Outside ui/input.tsx and ui/textarea.tsx, the entire repository contains four bare input or textarea tags, and all four are radio buttons inside two radio-card components. Every text field in the product is the same component, which is what makes an audit like this worth doing: anything wrong is wrong in one place, and anything missing can be added in one place.
Here is what those 76 fields declare:
| Attribute | Fields |
|---|---|
type |
19 |
maxLength |
18 |
autoComplete |
16 |
required |
12 |
autoFocus |
10 |
placeholder |
9 |
inputMode |
11 |
minLength |
5 |
aria-describedby |
2 |
pattern |
0 |
enterKeyHint |
0 |
autoCapitalize |
0 |
autoCorrect |
0 |
spellCheck |
0 |
The 19 types break down as six passwords, five emails, two numbers, two urls, two radios and one search, which means 57 fields are plain text, and plain text is usually right: a campaign name, a call to action, a payment method.
The 16px rule, and who actually paid for it
Safari on iOS zooms the page when you focus an input whose text is smaller than 16px, and it does not zoom back out. The fix is to make the font 16px on small screens, and this app has it:
/tools/engagement-rate-calculator at 390px wide: font-size 16px
/tools/engagement-rate-calculator at 1512px wide: font-size 14px
Both primitives carry text-base ... md:text-sm, so every field in the product is 16px up to 768px and 14px above it. Measured on the engagement rate calculator, which is public, so you can check it in a phone browser without an account.
I would like to claim that as a decision. It is not. text-base md:text-sm is what the component library's input shipped with, and I kept it because it looked right on a laptop. The iOS behaviour it defends against is one I did not think about until I started counting attributes, and the honest lesson is that a component library's defaults are doing accessibility and mobile work on your behalf that you will only discover by auditing it.
A decimal point on a field that counts people
11 fields set inputMode: six numeric, four url, one decimal. That single decimal is the one that matters, because it is in the shared calculator widget, so every field on all four calculator pages inherits it:
<Input id={id} inputMode="decimal" autoComplete="off" value={value} ... />
On the sponsorship cost calculator that is right for a CPM, which is 12.50 as often as 12. On the engagement rate calculator it is wrong for subscribers, views and likes, which are counts of whole things, and a keypad with a decimal point on it invites a number the parser will then quietly round. inputMode="numeric" is the correct value for those, and the only reason they all say decimal is that one component serves every field on every calculator.
Worth saying clearly: inputMode changes the keyboard, not the validation. All of these fields take a string and parse it, so "12.5 subscribers" is a parsing question either way. The attribute is about what the phone offers first.
Zero of four hint attributes
No enterKeyHint, no autoCapitalize, no autoCorrect, no spellCheck anywhere in the app. Three of those four are mostly covered by something else: type="email" and type="url" already turn capitalisation and autocorrect off in iOS, and the fields where capitalisation is wanted are names and campaign titles, where the default is what you want.
enterKeyHint is the one genuinely missing. The label on the phone's return key is "return" on every form in this app, including the three places where a different word is the whole message: a single-field password reset where the key means "send", the sign-in form where it means "go", and the creator search behind the login where it means "search". That is four attributes and no behaviour change, and it is now on the list.
The required checkbox nobody can see
The most interesting thing in this audit is on the sign-up page. Accepting the terms is a Radix checkbox, which renders a styled button plus a real input positioned off screen so the form still has a native value:
<input type="checkbox" aria-hidden="true" required tabindex="-1"
style="position:absolute;pointer-events:none;opacity:0;margin:0;transform:translateX(-100%)"
name="terms" value="on">
A required control that nobody can see is a trap, and it is worth seeing it spring. The same markup in isolation, with a submit button:
const before = { valid: f.checkValidity(), msg: cb.validationMessage };
f.querySelector("button").click();
before: { valid: false, msg: "Please tick this box if you want to proceed." }
after clicking submit: { submitted: false }
after ticking the box: { submitted: true }
The browser is doing its job: the form is invalid, the submit is blocked, and there is a message. The message is attached to an element with opacity: 0 sitting outside the viewport, so the user gets a button that does nothing and no explanation at all.
The app's answer turned out to be one line, and I had forgotten it was there:
// The browser blocks a submit with the box unticked; this says why, next to it.
onInvalidCapture={(e) => {
if ((e.target as HTMLInputElement).name === "terms") setTermsMissing(true);
}}
invalid is one of the few DOM events that does not bubble, so a listener on the form would never see it. React's synthetic capture phase does, because React dispatches through its own tree, and onInvalidCapture on the form catches the event from the hidden input on its way down. The component then renders its own message beside the visible checkbox, and clears it as soon as the box is ticked.
That is the pattern worth taking away. If you use any component library whose form controls hide a native input, every required on one of those controls has a validation message pointing at something invisible, and onInvalidCapture on the form is how you find out it happened.
Two smaller findings
autoComplete="off" appears three times, and all three are deliberate: the calculator fields, and the two "type your email address to confirm" boxes behind the login, one for deleting an account (which the privacy notice describes) and one for the admin equivalent, where a browser filling in the address for you would defeat the entire point of asking.
And an asymmetry I had not noticed until the attributes were in a table. The sign-in password field carries minLength={8}, the same as sign-up. A minimum length belongs on the field where a password is chosen, not on the field where an existing one is typed: if the rule ever loosens or an older account has a shorter password, the sign-in form will refuse to submit a password the server would have accepted. Nobody is affected today, as far as I can tell, because the same eight-character minimum has been in place for every account this app has ever created. That is exactly the kind of reasoning that leaves a bug in place for a year.
What I am changing
inputMode="numeric" for the whole-number calculator fields, enterKeyHint on the four places where the return key means something specific, minLength off the sign-in field, and a test that asserts every visible text input in the repository declares either a type or an inputMode. All of it is about three minutes of work, which is the thing about these attributes: the cost is not the fix, it is noticing.
Top comments (0)