How Firefox annoyed me with automatic form caching

2021-12-09 | 228 words

I don’t know when or why, but Firefox started caching forms, probably as a protection against accidental deletion, for example by refreshing the page. It may seem like a great feature for users, but I find it very non-standard.

When simply refreshing the page doesn’t help, you have to do a complete reload, for example using Ctrl+F5. But the average user doesn’t know this and practically has no way to clear the form other than manually, and thus won’t even find out its default state. What was pre-filled by default.

Website authors can turn off this behavior using autocomplete=“off”, but in my opinion, this is an attribute that should serve a completely different purpose…

What’s even worse is that it also works for checkboxes. Imagine a checkbox whose state you set via HTML from the backend - unchecked. And when the user checks it, you display an input for entering a value below it. That input is also unchecked in HTML. But when the user checks the checkbox and refreshes the page, the checkbox remains checked but the input is nowhere to be found. The input only appears when you uncheck the checkbox, which is the opposite of what it should be. This happens, of course, when you hide/show the input with a toggle function that simply switches the display state from none to, for example, block.