Building skills / CHIEFLETTER JOURNAL
Build a Contact Form People Can Use on Any Device
Improve a web form with clear labels, useful errors, keyboard support, and mobile-friendly fields. Includes a practical review checklist.
Ask for only the information you need
Every field asks for the visitor’s time and trust. Start with the reason for the form. If you need to reply, ask for an email address. If you need to route the message, a short topic list may help. Do not ask for a phone number, company size, or account details without a clear reason. Fewer fields reduce effort and reduce the data you need to protect.
Use a visible label for each field. Placeholder text disappears when someone starts typing and often has weak contrast. A label stays available and tells screen reader users what the field means. Put optional details in the label or nearby help text. Mark required fields clearly, and explain the rule before the person submits.
Choose error handling before styling the form. Decide whether errors appear beside each field, in a summary, or both. Long forms often need both. Keep the message visible after focus moves, and link each summary item to the field that needs attention. This helps people who scan the page and people who hear it read aloud.
Use the right input and state
Choose controls that match the information. Use an email input for an address and a text area for a message. Set a helpful autocomplete value when the browser supports it. On phones, the correct input type brings up a keyboard suited to the task. Give fields enough height and spacing for touch, and avoid layouts that require side-to-side scrolling.
Do not rely on color alone to show a required field or error. Pair color with text, an icon, or a clear border change. Keep the text large enough to read at the device’s default zoom. Let the page zoom, and check that labels and controls remain visible when the viewport narrows.
Do not reject a valid address because it uses a less common format. Email validation should catch missing structure, then let the mail system handle delivery. Avoid rules for names that reject hyphens, accents, spaces, or non-English letters. A form should accept the people it serves, not enforce assumptions about how they write their details.
When an address is malformed, keep the typed value, identify the field, and explain a correction. Do not reject names based on narrow assumptions.
Make keyboard use predictable
A visitor should be able to reach every field and the submit button with the keyboard. Keep focus in a sensible top-to-bottom order. Show a visible focus outline, and do not remove it to make the design look cleaner. If a custom dropdown or validation message uses JavaScript, confirm that keyboard users can open it, choose an option, and understand what changed.
Use a real button for submission and standard HTML form controls where possible. Native elements carry behavior browsers and assistive technology already understand. If the form has multiple sections, use headings and group related options with a fieldset and legend. A little semantic structure prevents a visual layout from becoming a maze when read aloud.
If submission fails because of a network problem, keep the visitor’s message in the field and offer a clear way to retry. Do not silently clear the form. If the site sends a confirmation email, say how long it usually takes and what to do if it does not arrive. This removes uncertainty after the person has already spent time writing.
Explain errors where people can fix them
When a field is invalid, say what needs to change. “Enter an email address in the format name@example.com” is more useful than “Invalid input.” Put the message beside the field and connect it to the control so assistive technology reads the relationship. Preserve the visitor’s other entries after an error.
After submission, move focus to a summary of errors or the first invalid field. Also show a clear success message when the form works. Do not make someone guess whether the button responded. If submission can take time, announce progress and prevent accidental repeat submissions while the request is in flight.
Check the form with a screen reader or accessibility tree. Confirm each field announces its name, required state, help text, and error when relevant. Ask a disabled visitor to complete the real task if you have a suitable participant. A working keyboard path alone does not reveal every barrier.
Test the whole task, not only the appearance
Complete the form on a narrow phone and a desktop. Try a keyboard only. Use an address with a plus sign, a long name, a long message, and a missing required field. Check that the page explains each problem and that the submitted message reaches its destination. A form that looks right in a screenshot may still fail after the button is pressed.
Ask one person who did not build it to send a test message. Watch where they pause and what they expect. Check the actual inbox or service that receives submissions. Remove the test data afterward. If you collect personal details, state how you use them near the form and follow your site’s privacy policy.
Treat submissions as personal information. Send the message only to the people who need it, limit access to the inbox, and remove old messages under a clear retention rule. Tell the visitor what happens after they press Send. Do not add them to a marketing list unless they choose to subscribe through a separate, clear action.
A practical review before launch
Check labels, instructions, focus order, contrast, error wording, success feedback, and touch size. Confirm the form works at 320 pixels wide without clipping. Try browser zoom. Verify the destination and the handling of a failed request. Keep a note of the browser and device you used so you can repeat the check after a redesign.
If a form supports a critical service, ask disabled users to test it and use a recognized accessibility checklist. Automated scans find some coding problems, but they do not tell you whether the language makes sense or whether the task feels clear. Fix issues that block completion first, then polish spacing and visual details.
Forms also attract automated spam. Add protections that do not create a new barrier, and monitor failures after launch. A hidden field or rate limit might reduce abuse, but test the flow with keyboard and assistive technology. If a third-party service handles the message, check its privacy terms and include the service in your site disclosures.
A short working note
Try this with your work
Improve a web form with clear labels, useful errors, keyboard support, and mobile-friendly fields. Includes a practical review checklist.
Focus session
Give one idea your attention.
Use a short, quiet work block to try one step from this article.
25 minutes
Video resources
For a visual walkthrough related to this topic, see this YouTube learning resource. It opens a topic search so you can choose a current explanation that fits your level.
Frequently asked questions
What makes a web form accessible?
Clear labels, keyboard support, visible focus, understandable errors, sufficient contrast, and feedback after submission. Test with real tasks and assistive technology.
Should I use placeholder text as a label?
No. Keep a visible label so the field’s purpose stays clear after a visitor starts typing.
How do I make a form mobile friendly?
Use a single-column layout, suitable input types, readable text, generous touch targets, and test at narrow widths and browser zoom.
Do automated accessibility scans cover forms?
They catch some technical issues. Manual keyboard checks and user testing reveal problems with wording, flow, and task completion.