<story><title>You probably don’t need input type=“number”</title><url>http://bradfrost.com/blog/post/you-probably-dont-need-input-typenumber/</url></story><parent_chain><item><author>benatkin</author><text>The problem with this is the browser and desktop environment makers. The correct thing to do is &amp;lt;input type=&amp;quot;number&amp;quot;&amp;gt; and it&amp;#x27;s a reasonable choice even though it&amp;#x27;s not the most optimal UI for your site. If the user encounters it the average Hacker News reading developer&amp;#x27;s site, it&amp;#x27;s probably a good thing it was there and not somewhere more critical, so they&amp;#x27;ll notice and maybe not make the same mistake when they&amp;#x27;re submitting adoption papers or something.&lt;p&gt;I like the article, and have enjoyed everything I&amp;#x27;ve read that Brad Frost has written, but I will probably keep using &amp;lt;input type=&amp;quot;number&amp;quot;&amp;gt;. I hope somehow this gets back to browser and desktop environment makers and they fix this usability and accessibility issue.</text></item></parent_chain><comment><author>astura</author><text>Well... The spec actually says it&amp;#x27;s not the &amp;quot;correct&amp;quot; thing to do&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;www.w3.org&amp;#x2F;TR&amp;#x2F;html5&amp;#x2F;forms.html#number-state-(type=number)&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;www.w3.org&amp;#x2F;TR&amp;#x2F;html5&amp;#x2F;forms.html#number-state-(type=nu...&lt;/a&gt;&lt;p&gt;&amp;gt;The type=number state is not appropriate for input that happens to only consist of numbers but isn’t strictly speaking a number. For example, it would be inappropriate for credit card numbers or US postal codes. A simple way of determining whether to use type=number is to consider whether it would make sense for the input control to have a spinbox interface (e.g., with &amp;quot;up&amp;quot; and &amp;quot;down&amp;quot; arrows). Getting a credit card number wrong by 1 in the last digit isn’t a minor mistake, it’s as wrong as getting every digit incorrect. So it would not make sense for the user to select a credit card number using &amp;quot;up&amp;quot; and &amp;quot;down&amp;quot; buttons. When a spinbox interface is not appropriate, type=text is probably the right choice (possibly with a pattern attribute).</text></comment>
<story><title>You probably don’t need input type=“number”</title><url>http://bradfrost.com/blog/post/you-probably-dont-need-input-typenumber/</url></story><parent_chain><item><author>benatkin</author><text>The problem with this is the browser and desktop environment makers. The correct thing to do is &amp;lt;input type=&amp;quot;number&amp;quot;&amp;gt; and it&amp;#x27;s a reasonable choice even though it&amp;#x27;s not the most optimal UI for your site. If the user encounters it the average Hacker News reading developer&amp;#x27;s site, it&amp;#x27;s probably a good thing it was there and not somewhere more critical, so they&amp;#x27;ll notice and maybe not make the same mistake when they&amp;#x27;re submitting adoption papers or something.&lt;p&gt;I like the article, and have enjoyed everything I&amp;#x27;ve read that Brad Frost has written, but I will probably keep using &amp;lt;input type=&amp;quot;number&amp;quot;&amp;gt;. I hope somehow this gets back to browser and desktop environment makers and they fix this usability and accessibility issue.</text></item></parent_chain><comment><author>kibibu</author><text>The right choice is `inputmode`, which says how to input the value without specifying semantics.&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;html.spec.whatwg.org&amp;#x2F;multipage&amp;#x2F;interaction.html#input-modalities%3A-the-inputmode-attribute&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;html.spec.whatwg.org&amp;#x2F;multipage&amp;#x2F;interaction.html#inpu...&lt;/a&gt;&lt;p&gt;It&amp;#x27;ll work in Chrome (and other Blink-based browsers), but nothing else.</text></comment>