• Resolved Sea Jay

    (@jcollier)


    Thank you for this important plug-in. I’m using it for a prototype learning community, and it will be critical to our success.

    http://learnmaine.net/

    One question. The WAVE validator indicates the label tags are malformed.

    http://wave.webaim.org/report?url=http%3A%2F%2Flearnmaine.net%2F&js=2

    The current structure is this:

    <label>Learning levels:</label>
    <select name="learning-levels">

    I believe it should be thus:

    <label for="learning-levels">Learning levels:</label>
    <select name="learning-levels" id="learning-levels">

    Will you consider making this change in an upcoming update?

    In any case, thank you again!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter Sea Jay

    (@jcollier)

    Found the issue.

    In order to validate at <http://wave.webaim.org/&gt;, the following change needs to be made in dropdowns.html

    Change …

    <label>{{title}}:</label>
    <select name="{{name}}">

    … to …

    <label for="{{name}}">{{title}}:</label>
    <select name="{{name}}" id="{{name}}">

    This changes the widget dropdown code from …

    <label>Learning levels:</label>
    <select name="learning-levels">

    … to …

    <label for="learning-levels">Learning levels:</label>
    <select name="learning-levels" id="learning-levels">

    I tested and it validates fine.

    In all other ways, a 5* plugin.

    Plugin Author scribu

    (@scribu)

    Thanks for bringing this up, but I’m concerned about setting id attributes, since they might collide with other elements on the page.

    Could you test if putting the select element inside the label validates?

    <label>{{title}}:
      <select name="{{name}}">
      ...
      </select>
    </label>
    Thread Starter Sea Jay

    (@jcollier)

    Yes, I understand, and agree. However, I believe the HTML/XHTML standard requires the ID:

    http://www.w3schools.com/tags/tag_label.asp

    If I were to add an obscure prefix to for/id, is that better?

    <label for="qmtlabel-{{name}}">{{title}}:</label>
    <select name="{{name}}" id="qmtlabel-{{name}}">

    Still validates. Less likely to collide?

    The for attribute is essential for screen reader users. Without it, forms are impossible to use. I’ve found that something along the lines of <?php echo $name;?>_<?php esc_attr_e( $option['value'] ); ?>"> for both the label’s for attribute and the associated input tends to work well across the board. And if the whole form has it’s own unique id, any rare CSS collisions can be easily dealt with.

    Plugin Author scribu

    (@scribu)

    Yeah, adding a prefix would fix this.

    However, putting the select into the label seems to also be valid.

    Ran this markup through http://wave.webaim.org/

    Plugin Author scribu

    (@scribu)

    And the W3C agrees:

    To associate a label with another control implicitly, the control element must be within the contents of the LABEL element. In this case, the LABEL may only contain one control element. The label itself may be positioned before or after the associated control.

    http://www.w3.org/TR/html4/interact/forms.html#h-17.9.1

    So I’m going to go with that:

    https://github.com/scribu/wp-query-multiple-taxonomies/commit/f3c5f0acb90c37fe18ec0d86a9b9b7173340a6d7

    That change will be present in the development version (1.6-alpha) shortly.

    Thread Starter Sea Jay

    (@jcollier)

    Thanks for following-up on this!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘[query-multiple-taxonomies] Accesssibility validation’ is closed to new replies.