Tell a screen reader to ignore placeholder text within an input tag?
Asked Answered
M

2

8

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?

Meander answered 30/3, 2016 at 15:22 Comment(7)
ARIA hidden is a possibilityApologize
If it's placeholder text, then you're talking about a pre-release version of the app, yes? Surely the placeholders will be replaced with the intended actual text before the app is released? Unless you need to accommodate a blind developer, I think the question is moot -- the app is not ready for UI testing until the real UI elements are inserted in place of the placeholders.Gwendolin
By placeholder, I mean the placeholder inside something like an input tag. Sorry for the confusionMeander
Screen readers ignore placeholder text when you use the placeholder attribute.Bauble
If you specify a value for the 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, the name attribute.Gwendolin
Correction, SOME screen readers ignore placeholder text. I can't find any solutions to catch all cases.Bauble
This is the kind of thing that's easier for the screenreader user to control with their own settings (verbose or not).Cerda
A
5

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.

Alita answered 31/3, 2016 at 20:55 Comment(0)
A
-2

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.

Amberjack answered 3/4, 2016 at 12:14 Comment(6)
Sighted users can benefit from glancing at a MAC address field to quickly determine the expected format. Vision impaired users have to listen to the whole thing be read-out which is more likely to annoy and cause cognitive overload. Redundant information doesn't necessarily need to be made accessible.Nahshunn
If the sighted user can see the mac address quickly determine the format, how does a non-sighted user quickly determine the format?Amberjack
If the user is expected to enter a MAC address, then they probably already know the format. The obvious gotcha is that the user may be unsure if they have to enter the colons or not, which is why the input should ideally allow both ways (either by automatically inserting unentered colons or by ignoring entered ones).Nahshunn
@acbabis, I think we are in total agreement with each other. I'm just trying to convey the point that all users, whether sighted or not, should benefit from any hints on the screen. If the user already knows the mac address format, then why have placholder text? If the sighted user can benefit from a hint on whether colons are needed or not, the non-sighted user can benefit from that too. This is one of the essential tenets of accessibility.Amberjack
I think there's still a disagreement between our positions. I think that it's acceptable to intentionally hide specific things from a screenreader and that it can improve UX. If I understand correctly, you don't.Nahshunn
Two of my sight impaired co-workers on our accessibility team respectfully disagree. They want the same hints as sighted users. That's only a sample size of two, so is obviously not representative, but they're two actual people and not just theory about what the best UX should be.Amberjack

© 2022 - 2024 — McMap. All rights reserved.