This repository has been archived by the owner on Mar 9, 2024. It is now read-only.
Improve forms with HTML5 input types #192
Labels
status: in-progress
When an issue or PR is being worked on now.
type: feature request
New feature or request
Context
HTML5 has been available to use for what feels like ages now, and one really great feature they introduced was an increased number of form input types, such as email, url, number, and so on.
These input types allow mobile browsers to display appropriate keyboards (such as a numpad in the case of "number"), while also often providing instant client-side validation, preventing erroneous form submissions.
Swapping to HTML5 form types will provide users with a more pleasant data entry experience (especially on mobile browsers), while also providing users with instant feedback if they input something in an improper format, without them having to wait for a page reload to get feedback.
Possible implemantion
There are a great many forms throughout WordPress, showing up across both the front and backend. Updating the code would be easy enough — do a codebase search for something like
type=
and verify that each input is an appropriate type, update it if not, and then verify that the form displays and functions correctly. In the event that that a browser doesn't support one of the newer input types, they should interpret it as a text field, allowing the form to be submitted as it always has been.Possible Solution
No response
Will you be able to help with the implementation?
Assuming we're okay with deviating from the WordPress codebase in tiny amounts in potentially dozens of places, I'd be willing to go through my test install and see about updating the forms.
This is a big request (a codebase search for
type="text"
turns up 102 results, with another 6 fortype='text'
), though obviously not all of them would need changes.Thoughts?
I know there are some form inputs that will take extra care to replace — such as the time and date fields when editing posts' published time. Changing them to number fields makes them wider and affects the layout of the page.
The text was updated successfully, but these errors were encountered: