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

Axe accessibility test support #2080

Merged
merged 7 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/axe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Axe accessibility testing

on:
# if you want to run this on every push uncomment the following lines
# push:
# branches:
# - master
# - main
# pull_request:
# branches:
# - master
# - main
workflow_dispatch:
inputs:
url:
description: "URL to be checked (e.g.: blog/)"
required: false

permissions:
contents: write

env:
URL: ""

jobs:
check:
# available images: https://github.com/actions/runner-images#available-images
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2.2"
bundler-cache: true
- name: Update _config.yml ⚙️
uses: fjogeleit/yaml-update-action@v0.13.1
with:
commitChange: false
valueFile: "_config.yml"
changes: |
{
"giscus.repo": "${{ github.repository }}",
"baseurl": ""
}
- name: Install and Build 🔧
run: |
pip3 install --upgrade jupyter
npm install -g mermaid.cli
npm install -g purgecss
export JEKYLL_ENV=production
bundle exec jekyll build --lsi
purgecss -c purgecss.config.js
- name: Run axe 🪓
# https://github.com/dequelabs/axe-core-npm/tree/develop/packages/cli
run: |
npm install -g @axe-core/cli
npm install -g http-server
http-server _site/ &
axe http://localhost:8080/${{ github.event.inputs.url || env.URL }} --load-delay=1500 --exit
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ Workshop on Diffusion Models (NeurIPS: <a href="https://diffusionworkshop.github
- [Social media previews](#social-media-previews)
- [Atom (RSS-like) Feed](#atom-rss-like-feed)
- [Related posts](#related-posts)
- [Code quality checks](#code-quality-checks)
- [FAQ](#faq)
- [Contributing](#contributing)
- [Maintainers](#maintainers)
Expand Down Expand Up @@ -365,6 +366,16 @@ It generates an Atom (RSS-like) feed of your posts, useful for Atom and RSS read

By default, there will be a related posts section on the bottom of the blog posts. These are generated by selecting the `max_related` most recent posts that share at least `min_common_tags` tags with the current post. If you do not want to display related posts on a specific post, simply add `related_posts: false` to the front matter of the post. If you want to disable it for all posts, simply set `enabled` to false in the `related_blog_posts` section in [\_config.yml](_config.yml).

#### Code quality checks

Currently, we run some checks to ensure that the code quality and generated site are good. The checks are done using GitHub Actions and the following tools:

- [Prettier](https://prettier.io/) - check if the formatting of the code follows the style guide
- [lychee](https://lychee.cli.rs/) - check for broken links
- [Axe](https://github.com/dequelabs/axe-core) (need to run manually) - do some accessibility testing

We decided to keep `Axe` runs manual because fixing the issues are not straightforward and might be hard for people without web development knowledge.

## FAQ

For frequently asked questions, please refer to [FAQ.md](FAQ.md).
Expand Down
4 changes: 2 additions & 2 deletions _includes/footer.liquid
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% if site.footer_fixed %}
<footer class="fixed-bottom">
<footer class="fixed-bottom" role="contentinfo">
<div class="container mt-0">
&copy; Copyright {{ site.time | date: '%Y' }}
{{ site.first_name }}
Expand All @@ -14,7 +14,7 @@
</div>
</footer>
{% else %}
<footer class="sticky-bottom mt-5">
<footer class="sticky-bottom mt-5" role="contentinfo">
<div class="container">
&copy; Copyright {{ site.time | date: '%Y' }}
{{ site.first_name }}
Expand Down
2 changes: 1 addition & 1 deletion _includes/header.liquid
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<header>
<!-- Nav Bar -->
<nav id="navbar" class="navbar navbar-light navbar-expand-sm {% if site.navbar_fixed %}fixed-top{% else %}sticky-top{% endif %}">
<nav id="navbar" class="navbar navbar-light navbar-expand-sm {% if site.navbar_fixed %}fixed-top{% else %}sticky-top{% endif %}" role="navigation">
<div class="container">
{% if page.permalink != '/' %}
<a class="navbar-brand title font-weight-lighter" href="{{ site.baseurl }}/">
Expand Down
2 changes: 1 addition & 1 deletion _layouts/default.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{% include header.liquid %}

<!-- Content -->
<div class="container mt-5">
<div class="container mt-5" role="contentinfo">
{% if page.toc and page.toc.sidebar %}
{% if page.toc.sidebar == 'right' %}
<div class="row">
Expand Down