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?
The best way is to add a hidden label and associate input element with attribute to the respective label.
Assistive technologies, such as screen readers, do not treat placeholder text as labels. Moreover, at the time of writing this tutorial, placeholder text is not broadly supported across assistive technologies and not displayed in older web browsers.
The conventional way is to use CSS ( display:none; and visibility:hidden; ) or the HTML 5 `hidden` attribute. These properties hide elements not only on the screen, but also for screen reader users. Thus, these elements will not be visible nor vocalized by Assistive technologies (AT).
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 its MAC address should already know what it looks like. Best way would be to provide a help link to a glossary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With