logo

drewdevault.com

[mirror] blog and personal website of Drew DeVault git clone https://hacktivis.me/git/mirror/drewdevault.com.git

You-cant-capture-the-nuance.md (5773B)


  1. ---
  2. title: You can't capture the nuance of my form fields
  3. date: 2021-06-27
  4. ---
  5. Check out this text box:
  6. <style>
  7. textarea {
  8. width: 100%;
  9. }
  10. </style>
  11. <textarea rows="10" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">Consectetur qui consequatur voluptatibus voluptatem sit sint perspiciatis. Eos aspernatur ad laboriosam quam numquam quo. Quia reiciendis illo quo praesentium. Dolor porro et et sit dolorem quisquam totam quae.
  12. Ea molestias a aspernatur dignissimos suscipit incidunt. Voluptates in vel qui quaerat. Asperiores vel sit rerum est ipsam. Odio aut aut voluptate qui voluptatem.
  13. Quia consequatur provident fugiat voluptatibus consequatur. Est sunt aspernatur velit. Officiis a dolorum accusantium. Sint est ut inventore.</textarea>
  14. Here are some of the nuances of using this text box on my operating system
  15. (Linux) and web browser (Firefox):
  16. - Double clicking selects a word, and triple-clicking selects the whole line. If
  17. I double- or triple-click-and-hold, I can drag the mouse to expand the
  18. selection word-wise or line-wise, not just character-wise. This works with the
  19. paragraphs of text in the body of this blog post, too.
  20. - Holding control and pressing right will move move word-wise through the file.
  21. It always moves to the start or end of the next or prior word, so pressing
  22. "control+left, control+left, control+right" will end up in a different
  23. position than "control+left" alone. Adding "shift" to any of these will mutate
  24. the text selection.
  25. - Clicking any of the whitespace after the end of the text will put the cursor
  26. after the last character, even if you click to the left of the last character.
  27. This makes it easy to start appending text to the end.
  28. - Clicking and dragging from any point, I can drag the mouse straight upward,
  29. exceeding the bounds of the text box or even the entire web browser, to select
  30. all text from that point to the start of the text box. (Thanks minus for
  31. mentioning this one)
  32. - Selecting text and middle clicking anywhere will paste the text at the clicked
  33. location. This uses a separate, distinct clipboard from the one accessed with
  34. ctrl+c/ctrl+v. I can also use shift+insert to paste text from this secondary
  35. clipboard (this is called the "primary selection").
  36. I rely on all of these nuances when I use form controls in my everyday life.
  37. This is just for English, by the way. I often type in Japanese, which has an
  38. entirely alien set of nuances. Here's what that looks like on Android (mobile is
  39. another beast entirely, too!):
  40. <video src="https://l.sr.ht/u274.webm" muted autoplay loop controls>
  41. If you're seeing this, your browser doesn't support HTML5 video, or webm, idk.
  42. </video>
  43. Here's another control:
  44. <select>
  45. <option>Alabama</option>
  46. <option>Alaska</option>
  47. <option>Arizona</option>
  48. <option>Arkansas</option>
  49. <option>California</option>
  50. <option>Colorado</option>
  51. <option>Connecticut</option>
  52. <option>Delaware</option>
  53. <option>Florida</option>
  54. <option>Georgia</option>
  55. <option>Hawaii</option>
  56. <option>Idaho</option>
  57. <option>Illinois</option>
  58. <option>Indiana</option>
  59. <option>Iowa</option>
  60. <option>Kansas</option>
  61. <option>Kentucky</option>
  62. <option>Louisiana</option>
  63. <option>Maine</option>
  64. <option>Maryland</option>
  65. <option>Massachusetts</option>
  66. <option>Michigan</option>
  67. <option>Minnesota</option>
  68. <option>Mississippi</option>
  69. <option>Missouri</option>
  70. <option>Montana</option>
  71. <option>Nebraska</option>
  72. <option>Nevada</option>
  73. <option>New Hampshire</option>
  74. <option>New Jersey</option>
  75. <option>New Mexico</option>
  76. <option>New York</option>
  77. <option>North Carolina</option>
  78. <option>North Dakota</option>
  79. <option>Ohio</option>
  80. <option>Oklahoma</option>
  81. <option>Oregon</option>
  82. <option>Pennsylvania</option>
  83. <option>Rhode Island</option>
  84. <option>South Carolina</option>
  85. <option>South Dakota</option>
  86. <option>Tennessee</option>
  87. <option>Texas</option>
  88. <option>Utah</option>
  89. <option>Vermont</option>
  90. <option>Virginia</option>
  91. <option>Washington</option>
  92. <option>West Virginia</option>
  93. <option>Wisconsin</option>
  94. <option>Wyoming</option>
  95. </select>
  96. There's an invisible edit buffer, so I can type "Pennsylvania" (or just P) to
  97. select what I want. I can type "New" and then press down to select "New Jersey".
  98. If I make a mistake and I've kept track of what I've typed in my head, I can use
  99. backspace to make a correction, and it just works. I have lived in both of these
  100. places, and worked both of these keystrokes into my muscle memory. Filling out a
  101. form with my address on it and using an input box like this to select my state
  102. of residence takes me less than a second.
  103. You cannot capture all of this nuance in a home-grown form control, or even
  104. anything close to it, but many JavaScript programmers do it anyway. Whenever I
  105. encounter a custom form control, the time required to complete the form
  106. increases from under a second to as much as a minute.
  107. For myself, this is just very annoying. Imagine the same situation if you were
  108. blind. The standard form inputs work everywhere, and are designed with
  109. accessibility in mind, so you're used to them and can easily fill in forms which
  110. use the standard browser controls. But, when you hit a JavaScript-powered
  111. organic cage-free non-GMO text box, you're screwed.
  112. There are hundreds of little nuances that users learn to use their computers
  113. efficiently. The exact features a user relies on will vary between operating
  114. systems, browsers, hardware, natural languages, physical ability, and personal
  115. preferences and experience. There are dozens of tiny workflows that people
  116. depend on every day that have never even occurred to you.
  117. Making a custom form control with JavaScript is going to make life worse for a
  118. lot of people. Just don't do it. The browser's built-in controls are quite
  119. sufficient.