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

When TABing through the page if at least one value has already been added, no label is communicated to ATs. #25

Open
dac514 opened this issue Apr 19, 2019 · 0 comments

Comments

@dac514
Copy link

dac514 commented Apr 19, 2019

During a recent accessibility audit, we were told that, when TABing through the page if at least one value has already been added, no label is communicated to ATs.

Test case:

<div class="custom-metadata-field taxonomy_multi_select" data-slug="pb_authors">
  <label for="pb_authors">Author(s)</label>
  <div class="pb_authors" id="pb_authors-1">
    <select name="pb_authors[]" id="pb_authors" class="custom-metadata-select2" data-placeholder="Choose author(s)..." multiple>
      <option value="nicolo-machiavelli" selected='selected'>Nicolo Machiavelli</option>
      <option value="sheldon">Sheldon Smith</option></select>
  </div>
  <span class="description">
    <a class="button" href="edit-tags.php?taxonomy=contributor">Create New Contributor</a>
  </span>
</div>
$custom_metadata_field.find( '.custom-metadata-select2' ).each(function(index) {
  $(this).select2({ placeholder : $(this).attr('data-placeholder'), allowClear : true });
});

Executive summary: selected='selected'

The reason is because TABing lands the user on a .select2-search__field input. It currently renders like this in Chrome like:

<input class="select2-search__field" type="text" tabindex="0" autocomplete="off" 
autocorrect="off" autocapitalize="none" spellcheck="false" role="textbox" 
aria-autocomplete="list" placeholder="" style="width: 0.75em;">

(Looks different when no item is selected)

<input class="select2-search__field" type="text" tabindex="0" autocomplete="off" 
autocorrect="off" autocapitalize="none" spellcheck="false" role="textbox" 
aria-autocomplete="list" placeholder="Choose author(s)..." style="width: 398px;">

Maybe use text from <label for="xxx"> because <select id="xxx" is known?
Maybe an aria-label="<placeholder>"?
Better ideas?

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

No branches or pull requests

1 participant