Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is this bad to suggest that placeholder attributes can contain expected formats? #10183

Open
anevins12 opened this issue Mar 6, 2024 · 0 comments

Comments

@anevins12
Copy link

anevins12 commented Mar 6, 2024

What is the issue with the HTML Standard?

I was wondering whether others thought that the phrasing in the placeholder attribute definition around "a hint could be a sample value or a brief description of the expected format" is bad.

The placeholder attribute represents a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. A hint could be a sample value or a brief description of the expected format...
https://html.spec.whatwg.org/multipage/input.html#the-placeholder-attribute

By bad, I mean it can lead developers into using data requirements in placeholder attributes.

The next sentence goes on to state how the placeholder attribute should not replace the label:

The placeholder attribute should not be used as an alternative to a label. For a longer hint or other advisory text, the title attribute is more appropriate.

However, I don't think that developers will read and and think "I shouldn't use placeholder attributes to convey data examples alone", but rather "I should use placeholder attributes to convey data examples along with a label identifying the field."

We know the landscape of forms and authors do rely on placeholder attributes to communicate data requirements. It would be great if the HTML spec led by example by educating the best uses of attributes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant