Skip to content

Add pa11y as a local and CI test #1227

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

Merged
merged 95 commits into from
May 19, 2021
Merged

Add pa11y as a local and CI test #1227

merged 95 commits into from
May 19, 2021

Conversation

thisisdano
Copy link
Contributor

@thisisdano thisisdano commented May 12, 2021

Summary

Add accessibility and link validity scanning to our website. Now our website has accessibility scanning (with pa11y and aXe) and link validation and HTML5 validity scanning (with html-proofer). We've also remediated any errors discovered by these scans.

Improved CI scanning performance. We updated the cache and workflow settings to improve the speed of CircleCI workflows.

Requirements

This PR has a related uswds PR: uswds/uswds#4197
Merge that PR and update this PR's uswds dependency to develop before merging.

Details

See code comments

Copy link
Contributor

@mejiaj mejiaj left a comment

Choose a reason for hiding this comment

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

Added some minor suggestions, otherwise LGTM.

@@ -1,3 +1,3 @@
- **Follow input guidance.** These text fields should follow the accessibility [guidelines for all text inputs]({{ site.baseurl }}/form-controls/#text-inputs).
- **Follow input guidance.** These text fields should follow the accessibility [guidelines for all text inputs]({{ site.baseurl }}/components/text-input).
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- **Follow input guidance.** These text fields should follow the accessibility [guidelines for all text inputs]({{ site.baseurl }}/components/text-input).
- **Follow input guidance.** These text fields should follow the accessibility [guidelines for all text inputs]({{ site.baseurl }}/components/text-input/#text-input-guidance).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this case, I think I'd rather link to the page, rather than into the middle of the page

package.json Outdated
"check-contrast": "node ./utils/check-contrast.js",
"clean": "gulp clean-assets",
"crawl": "node config/crawl.js",
"federalist": "npx gulp build",
"lint": "gulp eslint scss-lint",
"prestart": "gulp build",
"serve": "bundle exec jekyll serve --drafts --future --incremental --livereload",
"proof": "bundle exec htmlproofer --assume-extension --disable-external --allow-hash-href --alt-ignore '/.*/' --file-ignore '/developers/' ./_site",
"serve": "npm run build-all-assets && bundle exec jekyll serve --drafts --future --incremental --livereload",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add localhost here so we get localhost:4000 instead of 127.0.0.1:3000?

Suggested change
"serve": "npm run build-all-assets && bundle exec jekyll serve --drafts --future --incremental --livereload",
"serve": "npm run build-all-assets && bundle exec jekyll serve --drafts --future --incremental --livereload --host=localhost",

@@ -1,5 +1,5 @@
<section class="usa-prose site-prose margin-top-5">
<h3 class="usa-heading heading-margin-alt">General accessibility guidance for forms</h3>
<h2 id="general-accessibility-guidance-for-forms" class="usa-heading heading-margin-alt">General accessibility guidance for forms</h2>
Copy link
Contributor

Choose a reason for hiding this comment

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

We should incorporate the changes in 022c439. It sets unique IDs with id="accessibility-{{ componentKey }}".


<p class="site-subheading">{{ release.published_at | date: "%B %d, %Y" }}</p>

{% assign id_replace = 'id="v%-' | replace: '%', release.name %}
{{ release.body | markdownify | replace: 'id="', id_replace | remove_relative_links }}

<div class="highlighter-rouge">
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this display of release notes intentional (gray box w/ markdown)?

Example
image

@mejiaj
Copy link
Contributor

mejiaj commented May 18, 2021

Just noticed this. Going to Federalist preview link and click on Components in main nav. It redirects me to http://localhost:4000/preview/uswds/uswds-site/dw-add-pa11y/components/overview/

About._.U.S.Web.Design.System.USWDS.-.InPrivate.-.Microsoft.Edge.2021-05-18.11-50-50.mp4

It's happening in Firefox, Chrome, and Edge.

@thisisdano
Copy link
Contributor Author

OK, fixed that localhost issue: by explicitly setting the host in the jekyll build we get proper output in the sitemap and no longer need the url key in config.yml that was resulting in that bad forward

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