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 "notitle": true should not remove <label> #321

Closed
madhaze opened this issue Feb 24, 2021 · 2 comments
Closed

Form "notitle": true should not remove <label> #321

madhaze opened this issue Feb 24, 2021 · 2 comments

Comments

@madhaze
Copy link

madhaze commented Feb 24, 2021

Removing <label> causes accessibility scans to fail.
For accessibility <input>s need to have <label> or can use aria-label. https://www.w3.org/WAI/tutorials/forms/labels/

right now if "notitle": true is set the element does not render.

"form": [
    {
      "key": "field",
      "notitle": true
    },
    {
      "type": "submit",
      "title": "Submit"
    }
  ]
<div class="controls">
  <input type="text" class="form-control" name="field" value="" id="jsonform-19-elt-field">
  <span class="help-block jsonform-errortext" style="display:none;"></span>
</div>

It adding a class like bootstraps sr-only to the <label> or adding aria-label attribute to the <input> would help make the form more accessible.

Below is the return from doing a test on https://jsonform.github.io/jsonform/playground/index.html?example=gettingstarted with the "notitle": true set.

Title: WCAG 1.3.1,WCAG 4.1.2: Ensures every form element has a label (#jsonform-20-elt-field)
Tags: Accessibility, WCAG 1.3.1, WCAG 4.1.2, label

Issue: Ensures every form element has a label (label - https://accessibilityinsights.io/info-examples/web/label)

Target application: JSON Form Playground - https://jsonform.github.io/jsonform/playground/index.html?example=gettingstarted

Element path: #jsonform-20-elt-field

Snippet:

How to fix:
Fix any of the following:
aria-label attribute does not exist or is empty
aria-labelledby attribute does not exist, references elements that do not exist or references >elements that are empty
Form element does not have an implicit (wrapped)
Form element does not have an explicit
Element has no title attribute
Element has no placeholder attribute
Element's default semantics were not overridden with role="none" or role="presentation"

Environment: Chrome version 88.0.4324.146

====

This accessibility issue was found using Accessibility Insights for Web 2.23.0 (axe-core 4.1.1), a tool that helps find and fix accessibility issues. Get more information & download this tool at >http://aka.ms/AccessibilityInsights.

@tchapi
Copy link
Member

tchapi commented Mar 1, 2021

Hi @madhaze and thanks for the report. I think the aria-label route seems the most logical and compatible. Would you be able to make a PR for this change ?

@stale
Copy link

stale bot commented Apr 30, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale label Apr 30, 2021
@tchapi tchapi added Accessibility and removed Stale labels May 1, 2021
@tchapi tchapi closed this as completed in 24c7bea May 7, 2021
piorek94 pushed a commit to piorek94/jsonform that referenced this issue Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants