surveyjs / survey-library

Free JavaScript form builder library with integration for React, Angular, Vue, jQuery, and Knockout.
https://surveyjs.io/form-library
MIT License
4.2k stars 812 forks source link

A11y: Invalid HTML #3580

Open gitslacker opened 3 years ago

gitslacker commented 3 years ago

Are you requesting a feature, reporting a bug or asking a question?

Reporting a bug.

What is the current behavior?

SurveyJS generates invalid HTML in some cases, which fails to meet WCAG requirements (see https://www.w3.org/WAI/WCAG21/quickref/?showtechniques=411#parsing ). In particular:

  1. div elements have a "name" attribute, which is invalid
  2. Text input elements have a "step" attribute (see #2607), but this is only valid for certain types of inputs (e.g. number)
  3. Dynamic matrix questions use the same HTML id (remove-row) for multiple buttons
  4. The totals row in dynamic matrix questions (the tfoot element) has a nested td element

What is the expected behavior?

SurveyJS should produce valid HTML, at least as required by accessibility standards.

How would you reproduce the current behavior (if this is a bug)?

Create a SurveyJS survey with a text element and a dynamic matrix. Extract the generated HTML from the DOM and run in the W3C HTML validator ( https://validator.w3.org/nu/ ).

Provide the test code and the tested page URL (if applicable)

Tested page URL: https://plnkr.co/edit/kojU2yCzROvAhjMT

Click the "Validate W3C" button to run the validator in a new tab. Only a subset of these errors needs to be fixed for WCAG compliance (items 1-4 listed above), see https://www.tpgi.com/wcag-2-0-parsing-error-bookmarklet/

Specify your

dmitry-kurmanov commented 3 years ago

We will investigate the problem and write back as soon as possible. Thanks.

dmitry-kurmanov commented 3 years ago

We discussed your proposals with the team and decided to add them to our "todo" list for a while. We are working on markup refactoring and after that, we could fix all those problems more efficiently.

Thanks, Dmitry SurveyJS Team