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

Switch to HTML-validate for validation #1144

Merged
merged 8 commits into from
Feb 19, 2025

Conversation

colinrotherham
Copy link
Contributor

@colinrotherham colinrotherham commented Feb 18, 2025

Description

This PR switches from HTMLHint to HTML-validate

It includes an .htmlvalidate.js config and moves HTML validation to the docs:build task

Lint task output

See the GOV.UK Frontend setup for comparison

Checklist

@colinrotherham
Copy link
Contributor Author

I've included a couple of simple fixes to avoid this build output:

[14:38:49] Error in plugin "validateHTML"
Message:
    error: <th> element must have a valid scope attribute: row, col, rowgroup or colgroup (wcag/h63) at dist/app/components/all.html:435:12:
  433 |       <tbody>
  434 |         <tr>
> 435 |           <th><strong>Day of the week</strong></th>
      |            ^^
  436 |           <th><strong>Opening hours</strong></th>
  437 |         </tr>
  438 |         <tr>
Details: https://html-validate.org/rules/wcag/h63.html


error: <th> element must have a valid scope attribute: row, col, rowgroup or colgroup (wcag/h63) at dist/app/components/all.html:436:12:
  434 |         <tr>
  435 |           <th><strong>Day of the week</strong></th>
> 436 |           <th><strong>Opening hours</strong></th>
      |            ^^
  437 |         </tr>
  438 |         <tr>
  439 |           <th>Monday</th>
Details: https://html-validate.org/rules/wcag/h63.html


error: <th> element must have a valid scope attribute: row, col, rowgroup or colgroup (wcag/h63) at dist/app/components/all.html:439:12:
  437 |         </tr>
  438 |         <tr>
> 439 |           <th>Monday</th>
      |            ^^
  440 |           <td>9am to 6pm</td>
  441 |         </tr>
  442 |         <tr>
Details: https://html-validate.org/rules/wcag/h63.html


error: <th> element must have a valid scope attribute: row, col, rowgroup or colgroup (wcag/h63) at dist/app/components/all.html:443:12:
  441 |         </tr>
  442 |         <tr>
> 443 |           <th>Tuesday</th>
      |            ^^
  444 |           <td>9am to 6pm</td>
  445 |         </tr>
  446 |         <tr>
Details: https://html-validate.org/rules/wcag/h63.html


error: <th> element must have a valid scope attribute: row, col, rowgroup or colgroup (wcag/h63) at dist/app/components/all.html:447:12:
  445 |         </tr>
  446 |         <tr>
> 447 |           <th>Wednesday</th>
      |            ^^
  448 |           <td>9am to 6pm</td>
  449 |         </tr>
  450 |         <tr>
Details: https://html-validate.org/rules/wcag/h63.html


error: <th> element must have a valid scope attribute: row, col, rowgroup or colgroup (wcag/h63) at dist/app/components/all.html:451:12:
  449 |         </tr>
  450 |         <tr>
> 451 |           <th>Thursday</th>
      |            ^^
  452 |           <td>9am to 6pm</td>
  453 |         </tr>
  454 |         <tr>
Details: https://html-validate.org/rules/wcag/h63.html


error: <th> element must have a valid scope attribute: row, col, rowgroup or colgroup (wcag/h63) at dist/app/components/all.html:455:12:
  453 |         </tr>
  454 |         <tr>
> 455 |           <th>Friday</th>
      |            ^^
  456 |           <td>9am to 6pm</td>
  457 |         </tr>
  458 |         <tr>
Details: https://html-validate.org/rules/wcag/h63.html


error: <th> element must have a valid scope attribute: row, col, rowgroup or colgroup (wcag/h63) at dist/app/components/all.html:459:12:
  457 |         </tr>
  458 |         <tr>
> 459 |           <th>Saturday</th>
      |            ^^
  460 |           <td>9am to 1pm</td>
  461 |         </tr>
  462 |         <tr>
Details: https://html-validate.org/rules/wcag/h63.html


error: <th> element must have a valid scope attribute: row, col, rowgroup or colgroup (wcag/h63) at dist/app/components/all.html:463:12:
  461 |         </tr>
  462 |         <tr>
> 463 |           <th>Sunday</th>
      |            ^^
  464 |           <td>Closed</td>
  465 |         </tr>
  466 |       </tbody>
Details: https://html-validate.org/rules/wcag/h63.html


error: <th> element must have a valid scope attribute: row, col, rowgroup or colgroup (wcag/h63) at dist/app/components/details/expander.html:67:18:
  65 |             <tbody>
  66 |               <tr>
> 67 |                 <th><strong>Day of the week</strong></th>
     |                  ^^
  68 |                 <th><strong>Opening hours</strong></th>
  69 |               </tr>
  70 |               <tr>
Details: https://html-validate.org/rules/wcag/h63.html


error: <th> element must have a valid scope attribute: row, col, rowgroup or colgroup (wcag/h63) at dist/app/components/details/expander.html:68:18:
  66 |               <tr>
  67 |                 <th><strong>Day of the week</strong></th>
> 68 |                 <th><strong>Opening hours</strong></th>
     |                  ^^
  69 |               </tr>
  70 |               <tr>
  71 |                 <th>Monday</th>
Details: https://html-validate.org/rules/wcag/h63.html


error: <th> element must have a valid scope attribute: row, col, rowgroup or colgroup (wcag/h63) at dist/app/components/details/expander.html:71:18:
  69 |               </tr>
  70 |               <tr>
> 71 |                 <th>Monday</th>
     |                  ^^
  72 |                 <td>9am to 6pm</td>
  73 |               </tr>
  74 |               <tr>
Details: https://html-validate.org/rules/wcag/h63.html


error: <th> element must have a valid scope attribute: row, col, rowgroup or colgroup (wcag/h63) at dist/app/components/details/expander.html:75:18:
  73 |               </tr>
  74 |               <tr>
> 75 |                 <th>Tuesday</th>
     |                  ^^
  76 |                 <td>9am to 6pm</td>
  77 |               </tr>
  78 |               <tr>
Details: https://html-validate.org/rules/wcag/h63.html


error: <th> element must have a valid scope attribute: row, col, rowgroup or colgroup (wcag/h63) at dist/app/components/details/expander.html:79:18:
  77 |               </tr>
  78 |               <tr>
> 79 |                 <th>Wednesday</th>
     |                  ^^
  80 |                 <td>9am to 6pm</td>
  81 |               </tr>
  82 |               <tr>
Details: https://html-validate.org/rules/wcag/h63.html


error: <th> element must have a valid scope attribute: row, col, rowgroup or colgroup (wcag/h63) at dist/app/components/details/expander.html:83:18:
  81 |               </tr>
  82 |               <tr>
> 83 |                 <th>Thursday</th>
     |                  ^^
  84 |                 <td>9am to 6pm</td>
  85 |               </tr>
  86 |               <tr>
Details: https://html-validate.org/rules/wcag/h63.html


error: <th> element must have a valid scope attribute: row, col, rowgroup or colgroup (wcag/h63) at dist/app/components/details/expander.html:87:18:
  85 |               </tr>
  86 |               <tr>
> 87 |                 <th>Friday</th>
     |                  ^^
  88 |                 <td>9am to 6pm</td>
  89 |               </tr>
  90 |               <tr>
Details: https://html-validate.org/rules/wcag/h63.html


error: <th> element must have a valid scope attribute: row, col, rowgroup or colgroup (wcag/h63) at dist/app/components/details/expander.html:91:18:
  89 |               </tr>
  90 |               <tr>
> 91 |                 <th>Saturday</th>
     |                  ^^
  92 |                 <td>9am to 1pm</td>
  93 |               </tr>
  94 |               <tr>
Details: https://html-validate.org/rules/wcag/h63.html


error: <th> element must have a valid scope attribute: row, col, rowgroup or colgroup (wcag/h63) at dist/app/components/details/expander.html:95:18:
  93 |               </tr>
  94 |               <tr>
> 95 |                 <th>Sunday</th>
     |                  ^^
  96 |                 <td>Closed</td>
  97 |               </tr>
  98 |             </tbody>
Details: https://html-validate.org/rules/wcag/h63.html


error: Duplicate form control name "email" (form-dup-name) at dist/app/components/checkboxes/none-of-the-above.html:68:67:
  66 |
  67 |     <div class="nhsuk-checkboxes__item">
> 68 |       <input class="nhsuk-checkboxes__input" id="contact-1" name="email" type="checkbox" value="email" data-checkbox-exclusive-group="communication-preferences" aria-controls="conditional-contact-1" aria-expanded="false">
     |                                                                   ^^^^^
  69 |       <label class="nhsuk-label nhsuk-checkboxes__label" for="contact-1">
  70 |         Email
  71 |       </label>    </div>
Details: https://html-validate.org/rules/form-dup-name.html


error: Duplicate form control name "phone" (form-dup-name) at dist/app/components/checkboxes/none-of-the-above.html:82:67:
  80 |
  81 |     <div class="nhsuk-checkboxes__item">
> 82 |       <input class="nhsuk-checkboxes__input" id="contact-2" name="phone" type="checkbox" value="phone" data-checkbox-exclusive-group="communication-preferences" aria-controls="conditional-contact-2" aria-expanded="false">
     |                                                                   ^^^^^
  83 |       <label class="nhsuk-label nhsuk-checkboxes__label" for="contact-2">
  84 |         Phone
  85 |       </label>    </div>
Details: https://html-validate.org/rules/form-dup-name.html


20 errors found.

[14:38:49] 'docs:build' errored after 2.47 s

Base automatically changed from browser-compatibility to main February 19, 2025 08:06
@colinrotherham colinrotherham force-pushed the package-updates-accessibility branch from d956fbc to e3efe61 Compare February 19, 2025 08:41
Copy link
Contributor

@frankieroberto frankieroberto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@colinrotherham colinrotherham merged commit 4a08c45 into main Feb 19, 2025
5 checks passed
@colinrotherham colinrotherham deleted the package-updates-accessibility branch February 19, 2025 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants