Urgent.News

What's breaking now, across thousands of outlets.

Tech

An email field can have the right type and the wrong purpose

A contact form asks for a person's email address. Another field on the same page asks for the email address of a colleague to invite. Both fields might use type="email" , but they do not collect the same information. The type describes the input format; it does not, by itself, say whose address belongs in the field. W3C's Identify Input Purpose guidance makes that distinction explicit. For listed…

An email field on a contact form may request the user's own address, while another seemingly identical field on the same page could be requesting the address of a colleague. Both fields might use the "type=email" attribute, but this attribute alone does not define the purpose of the data collected. The Web Content Accessibility Guidelines (WCAG) provide guidance to distinguish between these purposes.

By using the "autocomplete" attribute, developers can specify the intended purpose of the field, making it more clear to assistive technologies. To avoid confusion, a developer should first identify the purpose of the field before modifying the markup. For a field collecting the user's email, setting "autocomplete=email" is appropriate.

However, a field intended for inviting a colleague should have its own unique purpose. Additionally, the visible label of the field should be clear to prevent miscommunication. The same applies to name fields, where "type=text" does not specify whether the form expects a full name, first name, or last name. WCAG provides fixed tokens like "name", "given-name", and "family-name" to indicate different purposes.

Before making any changes, testers should verify the actual data collected by the form and its accessible name. They should also test the form in a browser with saved profile data to ensure the user's information is not mistakenly offered in a field meant for someone else. This process should be repeated after any source changes, as templates can render different fields from similar components. The final step is to verify the meaning and behavior of the live form, not just the scan results.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Building a Robinhood Trading MCP Risk Gateway with TypeScript

AI agents can now do more than answer questions. They can interact with external applications through tools. Robinhood's Trading MCP is one example: an external AI agent can connect to Robinhood and…

  • Robinhood Trading MCP Risk Gateway built with TypeScript
  • Gateway ensures deterministic controls between AI agent and trading
  • System flow: Natural Language → AI Agent → Structured Trade Intent

More from Wednesday 7 October →