Ode to Textarea
Textarea, how do I hate thee?
Let me count the ways…
- Undon’t:
-
In Firefox, the text selection API is so broken, so useless that developers must
replace the whole text of the textarea in order to insert something at the insertion point. The
effect works as far as inserting, but it kills the undo, meaning that when you do an undo, the
whole text gets selected.
This has been like this since Firefox 1.0 and likely long, long before in the days of Netscape.
This is failure on a 400 million user scale. How does this slide? Does nobody in
Mozilla use a textarea, ever, never, not even once a day? IE has never had this problem. It has a
proprietary text-selection API, sure, but at least it works. And contentEditable and
XMLHTTPRequest eventually became standards, so there’s hope yet.
- Search and Replace:
-
Even Notepad supports this. Why, not only in 2011, but fifteen years after textarea was
added to HTML 2.0 and terabytes upon terabytes of text have been entered into it, has no browser
vendor ever thought at any point that they should take a day to implement search and replace? This
is procrastination on an epic scale. What the crap could distract an entire industry for 15 years?
Imagine Microsoft had not yet gotten around to implementing search and replace in Word yet.
I use VB6 (12 years old) when I need to code a simple native applications for Windows, and even
VB6 can get this right. Hang your heads in shame, browser vendors.
- Stop making me rush:
-
You know why I write my articles in a proper text editor on an OS, instead of a textarea in a web
form? Because for the last 15 years I have had it drummed—nay pummelled—into me that textarea
is not to be trusted with valuable content. We have become conditioned to write our thoughts out
in one sitting, as quickly as possible, and submit. Nobody works on an article for a
month in a textarea.
Developers design web sites around this very notion that we must blurt out our intentions as
quickly as possible and hurry on to the next page before the goblins break down the door.
Imagine a web where I could work on a lengthy, reasoned comment to a blog post over a couple of
days. Sure, I could do that anyway—nothing is preventing me—writing the text in an
editor and copying the text to the web, but people don’t. The design of web sites is incredibly
powerful and suggestive and textarea throws us into a blind panic every single time.
Comments on the web suck in part because textarea sucks.
Sure many web browsers have session restore. Do you trust it? No, of course not. Do you copy your
text before you press submit in case the web site you are using is so badly programmed it errors
and either kills your text? Or the back button does.
- Style:
-
Why has this not been fixed in all these years? Sod existing content, a textarea being a few
pixels out of place is not going to kill anybody. (I would like to see that police
repot)
Incredibly, only Opera gets this right. Seems like they stopped to question the stupidity of
blindly copying everybody else’s mistake.
I don’t want an all singing, all dancing replacement for the textarea. I don’t want
rich text formatting. I don’t want design mode and la-de-da hot new features. Even with all of these things,
people will still need to just type some plain text. These features can never replace textarea, they will
only offer an alternative.
Browser vendors, stop for just one minute to realise that chasing after a never ending feature set has left you
blind to the wake of usability failure you have left unfixed behind you for the last 15 years.
If you want to add something to textarea, don’t wait for a specification. Nobody is interested. Don’t
ask for permission, ask for forgiveness. Use vendor prefixes and just go mad. Full screen edit? Speech
dictation? Syntax highlighting? bbcode helpers / autocorrect? Load / save to file? Inline translation? Detach and
float so you can scroll and compare text? If you think it’ll help somebody. Standards can be worked out later once
you have something so compelling everybody else just has to implement it.
A billion lines of JavaScript will not solve this problem. It lies squarely with browser vendors, not authors. No
amount of JavaScript can integrate textarea with the OS better. No amount of JavaScript will fix all the textareas
on all the pages in the web.
Fix textarea now. Not later. Not after you’ve shipped some other constantly changing HTML5 feature. Not when
someone else does so first. Now. Please accept the responsibility and the scale of the damage your lackadaisical
attitude has wrought.
In centuries to come, a teacher will be showing children a graph of historical life expectancy and a child will
raise their hand and ask what that little uptick is in the middle, and the teacher will reply “that’s the year
when browsers fixed the textarea”.