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

Placeholder text (A11y) #147

Open
j6design opened this issue Feb 6, 2016 · 8 comments
Open

Placeholder text (A11y) #147

j6design opened this issue Feb 6, 2016 · 8 comments
Labels

Comments

@j6design
Copy link

j6design commented Feb 6, 2016

When return to address input box, screen reader is picking up the placeholder text instead of the value in the box

@jszwedko jszwedko added the a11y label Feb 21, 2016
@scottcarol
Copy link

Hi @j6design, it looks like the placeholder text is being used as a label (not good for a11y).

Can you brainstorm a better solution with me?

Here is the current code. Right now there is no label:

%fieldset.form-group = search_field_tag "address", params[:address], :placeholder => t("labels.address"), :class => "search-query form-control" .help-block

I added a label that is visible to screen readers only:

%fieldset.form-group %label.sr-only{:for => "address"} = t("labels.address") = search_field_tag "address", params[:address], id:"address", :placeholder => t("labels.address"), :class => "search-query form-control" .help-block

However, the text of the sr-only label is "labels.address" -- which is the same as the placeholder text. This means the person with the screen reader will hear (in English) "Address, Neighborhood" two times -- once from the sr-only label and once from the placeholder text.

Ideally there would be a label for everyone to view, with supplemental placeholder text.

But if the design can't change, is this an acceptable solution for screen reader users?

@scottcarol
Copy link

Hey @jszwedko see this article on using placeholders as labels.

Any chance we can add a visible label to the address search form?

Otherwise, I can submit a pull request with the workaround I posted above, which adds an invisible label for screen readers only.

@jeanwalshie
Copy link
Collaborator

@scottcarol thanks for reviving this and for the informative article!

@scottcarol
Copy link

@jeanwalshie Thanks! I'm getting my adopt-a-drain feet wet (pun intended) and would like to start with a11y issues. Planning to come to the coding meetup 9/13 to meet some collaborators in person.

@jszwedko
Copy link
Member

Hey @scottcarol,

Apologies for the delay; I've been traveling the past couple of weeks. I agree with the points in the article you linked to would be happy to see the placeholder moved to a label on that field.

I'll be at the 9/13 hack night though and would be happy to chat more there!

@scottcarol
Copy link

@jszwedko - great. Something came up and I won't be there tonight but I will be there 9/20.

I'll submit a pull request for this as soon as I can.

@chaunceygraves
Copy link

chaunceygraves commented Sep 13, 2017 via email

@scottcarol
Copy link

Oops yes I meant I won't be there today (Wednesday) but will be there next week!

@scottcarol scottcarol self-assigned this Sep 21, 2017
@scottcarol scottcarol removed their assignment Feb 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants