brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: spellcheck="false" and autocorrect="off" keep phones away from usernames and codes

Web-Development
~/tips/tip-spellcheck-autocorrect-off-code-fields

spellcheck="false"

Fields for usernames, commands or codes stop getting red lines and corrected words.

Typing a username or a hostname on a phone often ends with a capital letter you did not want or a word swapped by autocorrect. Three attributes tell the browser to leave such a field alone.

<input type="text" name="username"
       spellcheck="false"
       autocapitalize="off"
       autocorrect="off">

<textarea name="config" spellcheck="false"></textarea>

spellcheck="false" removes the red squiggles, which only make a field full of commands or config look broken. autocapitalize="off" stops the virtual keyboard from starting with a capital, and autocorrect="off" stops it from replacing what you typed. Note that type="email" and type="url" already skip capitalization, so this matters most for plain text fields.

There is a privacy reason too. MDN warns that the content of a field may be sent to a third party for spellchecking, for example with enhanced spellcheck features, and suggests turning it off for fields with sensitive information.

Support differs per attribute. spellcheck works everywhere. autocapitalize matters on mobile keyboards and desktop Safari ignores it. autocorrect was a Safari thing for years; MDN lists Firefox 136 and Chrome 153 as the versions that added it. Since unsupported attributes are ignored, I’d just add all three.

Further reading: MDN: spellcheck, MDN: autocorrect

More Web-Development tips ab -n 200 -c 10 https://example.com/ console.assert(items.length > 0, 'cart is empty', items) document.designMode = "on" function save(item) { Save draft All Web-Development tips (67) All topics

Link