0

For the HTML element - Do I need dashes/markers around the "any" option to satisfy accessibility? If no markers, does the text have to be a sentence ? What types of text is accessible?

For example instead of:

  1. Single markers (seem most common):
<select name="place">
  <option value="">- Any -</option>
  <option value="paris">Paris</option>
  <option value="london">Londo</option>
</select>
  1. Double markers (Mozilla docs uses it):
<select name="place">
  <option value="">-- Any --</option>
  <option value="paris">Paris</option>
  <option value="london">London</option>
</select>

No Marker but generic text.

<select name="place">
  <option value="">Any</option>
  <option value="paris">Paris</option>
  <option value="london">London</option>
</select>

No Marker - use descriptor.

<select name="place">
  <option value="">Place</option>
  <option value="paris">Paris</option>
  <option value="london">London</option>
</select>

No Marker - use descriptor with dashes/markers.

<select name="place">
  <option value="">- Place - </option>
  <option value="paris">Paris</option>
  <option value="london">London</option>
</select>

1 Answer 1

0

There is nothing special about the "any" text. It's just another <option> value. Having a dash before/after the text will most likely not be read by a screen reader anyway since the default setting on screen readers is to not announce punctuation and special characters. A '-' may or may not be announced by default. The screen reader user can control how verbose the announcements are.

What is important is that your <select> have a label.

<label for="city">Select a city</label>
<select name="place" id="city">
  <option value="">- Any -</option>
  <option value="paris">Paris</option>
  <option value="london">Londo</option>
</select>

Don't rely on the value of the first <option> to be your label because once the user chooses a different value, you've essentially lost your "label".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.