Adding SearchInput widget

I’ve looked into all the input types listed on MDN, and come up with the following. I’ve linked a short explanation of my decision for each input type not currently in Django below the summary table.

tldr; we should add widgets for <input type=...>

Adding date, datetime-local, and time would likely require a breaking change to existing widgets, so I decided to not add those for the purposes of this thread. Could be another discussion for the future though.

Summary

Input Type In Django already? Should it be? Add it!
button :x: :x: :x:
checkbox :white_check_mark: :white_check_mark: :x:
color :x: :white_check_mark: :white_check_mark:
date :x: ? :x:
datetime-local :x: ? :x:
email :white_check_mark: :white_check_mark: :x:
file :white_check_mark: :white_check_mark: :x:
hidden :white_check_mark: :white_check_mark: :x:
image :x: :x: :x:
month :x: :x: :x:
number :white_check_mark: :white_check_mark: :x:
password :white_check_mark: :white_check_mark: :x:
radio :white_check_mark: :white_check_mark: :x:
range :x: :white_check_mark: :white_check_mark:
reset :x: :x: :x:
search :x: :white_check_mark: :white_check_mark:
submit :x: :x: :x:
tel :x: :white_check_mark: :white_check_mark:
text :white_check_mark: :white_check_mark: :x:
time :x: ? :x:
url :white_check_mark: :white_check_mark: :x:
week :x: :x: :x:

Justifications

button

Should not add. MDN discourages their use:

While <input> elements of type button are still perfectly valid HTML, the newer <button> element is now the favored way to create buttons.

color

Should add. Decent browser support as discussed above.

date

Should not add, but unsure. DateInput widget exists in Django already, but is rendered as type="text". Not sure if updating this widget to this input type is worthy of a breaking change.

datetime-local

Should not add, but unsure. DateTimeInput widget exists in Django already, but is rendered as type="text". Not sure if updating this widget to this input type is worthy of a breaking change.

image

Should not add. While well-supported, seems extremely niche:

<input> elements of type image are used to create graphical submit buttons, i.e. submit buttons that take the form of an image rather than text.

month

Should not add. Patchy browser support:

The control’s UI varies in general from browser to browser; at the moment support is patchy, with only Chrome/Opera and Edge on desktop — and most modern mobile browser versions — having usable implementations.

range

Should add. Similar to color, there is good browser support.

reset

Should not add. MDN discourages their use:

You should usually avoid including reset buttons in your forms. They’re rarely useful, and are instead more likely to frustrate users who click them by mistake (often while trying to click the submit button).

search

Should add. As discussed above, useful for accessibility and other reasons.

submit

Should not add. Their behaviour is more like a button than a form input element.

tel

Should add. There are benefits to using this type despite being functionally equivalent to type="text":

Despite the fact that inputs of type tel are functionally identical to standard text inputs, they do serve useful purposes; the most quickly apparent of these is that mobile browsers — especially on mobile phones — may opt to present a custom keypad optimized for entering phone numbers. Using a specific input type for telephone numbers also makes adding custom validation and handling of phone numbers more convenient.

time

Should not add, but unsure. TimeInput widget exists in Django already, but is rendered as type="text". Not sure if updating this widget to this input type is worthy of a breaking change.

week

Should not add. As discussed above, patchy browser support.