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

Form controls are not grouped #15304

Closed
karlgroves opened this issue Apr 30, 2019 · 3 comments
Closed

Form controls are not grouped #15304

karlgroves opened this issue Apr 30, 2019 · 3 comments
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes).

Comments

@karlgroves
Copy link

Form controls are not grouped

  • Severity: Low
  • Affected Populations:
    • Blind
    • Low-Vision
    • Cognitively Impaired
  • Platform(s):
    • All / Universal
  • Components affected:
    • Tools and Options

Issue description

Within the Options dialog, individual controls are split into sections
with preceding heading text, however this grouping is not described
using form semantics and therefore not properly conveyed to assistive
technologies.

Splitting complex forms into fieldsets helps assistive technology users
to understand the grouping and relationships between similar fields.

Issue Code
    <!-- General -->


    <section class="edit-post-options-modal__section">


       <h2 class="edit-post-options-modal__section-title">General</h2>


       <div class="components-base-control edit-post-options-modal__option">


          <div class="components-base-control__field">


              <input class="components-checkbox-control__input" id="inspector-checkbox-control-0" type="checkbox" checked="" value="1">


              <label class="components-checkbox-control__label" for="inspector-checkbox-control-0">Enable Pre-publish Checks</label>


           </div>


       </div>


        ...


    </section>





    <!-- Document Panel -->


    <section class="edit-post-options-modal__section">


       <h2 class="edit-post-options-modal__section-title">Document Panels</h2>


       <div class="components-base-control edit-post-options-modal__option">


          <div class="components-base-control__field">


             <input class="components-checkbox-control__input" id="inspector-checkbox-control-2" type="checkbox" checked="" value="1">


             <label class="components-checkbox-control__label" for="inspector-checkbox-control-2">Permalink</label>


          </div>


       </div>


    </section>





    <!-- Advanced Panels -->


    <section class="edit-post-options-modal__section">


       <h2 class="edit-post-options-modal__section-title">Advanced Panels</h2>


       <div class="components-base-control edit-post-options-modal__option">


          <div class="components-base-control__field">


             <input class="components-checkbox-control__input" id="inspector-checkbox-control-6" type="checkbox" value="1">


             <label class="components-checkbox-control__label" for="inspector-checkbox-control-6">Custom Fields</label>  


          </div>


       </div>


    </section>

Remediation Guidance

Turn the wrapping elements into <fieldset> and the group name
elements into <legend>. The <legend> elements themselves can
also contain inner <h2> elements, in order to continue providing
the benefits of a headings structure while still providing a form group
structure.

Recommended Code
    <!-- General -->


    <fieldset class="edit-post-options-modal__section">


       <legend><h2 class="edit-post-options-modal__section-title">General</h2></legend>


       <div class="components-base-control edit-post-options-modal__option">


          <div class="components-base-control__field">


             <input class="components-checkbox-control__input" id="inspector-checkbox-control-0" type="checkbox" checked="" value="1">


             <label class="components-checkbox-control__label" for="inspector-checkbox-control-0">Enable Pre-publish Checks</label>


           </div>


       </div>


       ...


    </fieldset>





    <!-- Document Panel -->


    <fieldset class="edit-post-options-modal__section">


       <legend><h2 class="edit-post-options-modal__section-title">Document Panels</h2></legend>


       <div class="components-base-control edit-post-options-modal__option">


          <div class="components-base-control__field">


             <input class="components-checkbox-control__input" id="inspector-checkbox-control-2" type="checkbox" checked="" value="1">


             <label class="components-checkbox-control__label" for="inspector-checkbox-control-2">Permalink</label>


          </div>


       </div>


    </fieldset>





    <!-- Advanced Panels -->


    <fieldset class="edit-post-options-modal__section">   


       <legend><h2 class="edit-post-options-modal__section-title">Advanced Panels</h2></legend>


       <div class="components-base-control edit-post-options-modal__option">


          <div class="components-base-control__field">


             <input class="components-checkbox-control__input" id="inspector-checkbox-control-6" type="checkbox" value="1">


             <label class="components-checkbox-control__label" for="inspector-checkbox-control-6">Custom Fields</label>  


          </div>


       </div>


    </fieldset>

Relevant standards

Note: This issue may be a duplicate with other existing accessibility-related bugs in this project. This issue comes from the Gutenberg accessibility audit, performed by Tenon and funded by WP Campus. This issue is GUT-54 in Tenon's report

@gziolo gziolo added the Needs Accessibility Feedback Need input from accessibility label Apr 30, 2019
@melchoyce
Copy link
Contributor

Full report screenshot:

image

@afercia
Copy link
Contributor

afercia commented May 5, 2019

Using fieldset and legends may definitely help. However, the group names should be changed as <legend> elements directly complement the checkbox labels.

For a good understanding of how <legend>s are supposed to be used, here's a very recommended article by Léonie Watson @LJWatson on the Gov.uk accessibility blog (powered by WordPress 🎉):
https://accessibility.blog.gov.uk/2016/07/22/using-the-fieldset-and-legend-elements/

@afercia afercia added [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). and removed Needs Accessibility Feedback Need input from accessibility labels May 5, 2019
@tellthemachines
Copy link
Contributor

Closing as this one was fixed by #39176 which changed the old section markup to use fieldset and legend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes).
Projects
None yet
Development

No branches or pull requests

5 participants