Some of the placeholder text I have in my app is a bit ridiculous for a screen reader (a sample MAC address, for example).
Is there a way I can tell a screen reader to ignore only the placeholder
text?
Some of the placeholder text I have in my app is a bit ridiculous for a screen reader (a sample MAC address, for example).
Is there a way I can tell a screen reader to ignore only the placeholder
text?
You can use a meaningful placeholder.
If you really want to define what a mac address should look like but don't want it to be read (for whatever reason), you can use the aria-hidden
attribute on some other element.
<label>MAC Address:
<input type="text" placeholder="Enter your mac address here" />
<span aria-hidden="true">(e.g. FF-AA-BB-CC-DD-EE)</span>
</label>
We can guess that a blind user who will have to type his MAC address should already know what it looks like. Best way would be to provide a help link to a glossary.
How do you know if placeholder text is "ridiculous for a screen reader"? And why single out screen reader users? Won't the placeholder text be "ridiculous" for some users in general, regardless of whether they use a screen reader?
If you're using the placeholder=
attribute, then you must have decided that it's helpful for some users. If so, then anything that's good for the sighted user should be good for the low/no vision user too.
If you have information on the screen that is helpful, there is rarely a case where that info should be hidden from screen reader users.
© 2022 - 2024 — McMap. All rights reserved.
placeholder
attribute of an<input>
element, then it has defined semantics that you should rely on screen readers to understand, just as they understand, say, thename
attribute. – Gwendolin