survey-library icon indicating copy to clipboard operation
survey-library copied to clipboard

A11y: Invalid HTML

Open gitslacker opened this issue 3 years ago • 2 comments

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

  • browser: Chrome
  • browser version: 95.0.4638.69
  • surveyjs platform (angular or react or jquery or knockout or vue): jQuery
  • surveyjs version: 1.8.76

gitslacker avatar Nov 05 '21 17:11 gitslacker

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

dmitry-kurmanov avatar Nov 06 '21 12:11 dmitry-kurmanov

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

dmitry-kurmanov avatar Nov 09 '21 11:11 dmitry-kurmanov