Kirby wrapper for automated content accessibility checkers Editoria11y and Sa11y

Overview

Kirby3 A11yprompter

For a comprehensive overview of Sa11y and Editoria11y, how they can assist maintaining an accessible website by supporting content editors, and to read about the rationale behind this plugin, check out the in-depth blog post at https://sebastiangreger.net/2021/11/sa11y-editoria11y-and-a-kirby-plugin

Overview

The A11yprompter (a11y as in accessibility, and prompter like the person assisting actors on stage) is a tiny wrapper to easily add a user-friendly automatic content accessibility checker to the frontend of a website built with Kirby 3.

The plugin currently integrates both Editoria11y and Sa11y, and even allows to try them both at random. They are specifically developed to assist content editors to not break a site's accessibility as they create content; not full-fledged accessibility validators, but tools that nudge editors to follow a11y guidelines.

Installation

Download and copy this repository to /site/plugins/kirby3-a11yprompter

Or use Composer:

composer require sgkirby/commentions

Or install as Git submodule

git submodule add https://github.com/sebastiangreger/kirby3-a11yprompter.git site/plugins/kirby3-a11yprompter

Setup

There is only one step needed to get started. Add the following to the template or snippet rendering the end of your HTML body (like site/snippets/footer.php in the Kirby Starterkit, for example), just before the closing </body> tag:

<?= snippet('a11yprompter') ?>

This will render the required <script> and <style> tags to include the checker tool in the page; by default, one of the two tools is chosen at random – think of it as a kind of "tryout" mode (while pretty similar, both tools have different UI and feature sets, so this might be handy to find your preferred solution).

The tool is only displayed when loading a web page as a logged-in user – careful if Kirby's built-in page cache is in use; you may want to disable page caching for logged-in users.

You should now be ready to go – make sure you are logged in to your Kirby website and open any page on the frontend that is rendered using the template/snippet with this code.

Configuration

Additional configuration variables can be included in the snippet call to customize the setup. The $data variable is expected to be an associative array, as with any other Kirby snippet:

<?= snippet('a11yprompter', $data) ?>

Checker engine selection

To turn off the randomized "tryout" mode and permanently settle for one engine, set the engine value accordingly:

Value Description
'engine' => 'sa11y' Uses Sa11y
'engine' => 'editoria11y' Uses Editoria11y
'engine' => 'random' or empty (default) Randomly uses one of the two – either Sa11y or Editoria11y – for every page load
'engine' => 'tota11y' Uses Tota11y; this "forebear" of the newer solutions, not updated since 2019, is only included here for reference purposes or very specific use cases, it is never shown when using the random option as its target audience is different from the others

So, to only use Sa11y, set:

<?= snippet('a11yprompter', ['engine' => 'sa11y']) ?>

NB. Both engine names do not contain L letters, but numeric characters 1.

Template limitation

By default, the checker tool is shown on every page that contains the template with this snippet. To limit, you may hand an array of template names to the snippet:

Value Description
templates => array An array of template IDs that will include the checker tool, e.g. 'templates' => ['article']

Access control

By default, the checker tool is shown to every logged-in user. You can limit this further by setting one of the following arrays in the $data variable:

Value Description
'users' => array An array of user IDs that will see the checker tool, e.g. 'users' => ['ascd1234', 'b2cy82t5']
'roles' => array An array of user roles that will see the checker tool, e.g. 'roles' => ['admin']

For example, a complete setup with template and access limitations could look like this:

<?= snippet('a11yprompter', [
    'engine'    => 'sa11y',
    'templates' => ['article', 'note'],
    'roles'     => ['admin', 'leadeditor'],
]) ?>

Script settings

To override selected default settings of the checker scripts, overwrite them using an array named after the tools' name:

Value Description
sa11y => array An array of variables for the Sa11y tool; see the variables and their explanations in sa11y-english.js
editoria11y => array An array of variables for the Editoria11y tool; see the variables and their explanations in editoria11y-prefs.js

For example, to change the Editoria11y variable ed11yAlertMode from its default value of polite to assertive, use the following code:

<?= snippet('a11yprompter', [
    'engine'      => 'editoria11y',
    'editoria11y' => [
        'ed11yAlertMode' => 'assertive',
    ],
]) ?>

This renders a line of script code setting ed11yAlertMode = 'assertive'; and thereby overwriting the default. Take a look at the various config variables of both scripts – they each enable a great (but different) amount of customization, from including/excluding certain areas to other interface settings.

Probably the most important setting is the limitation of the tested area to a specific DOM element (e.g. to only target the area that can be edited by authors, not the rest of page, usually rendered from fixed templates); default is the entire body:

Sa11y Editoria11y
'sa11yCheckRoot' => '#content' 'ed11yCheckRoot' => '#content'

Credits

This plugin is merely a little helper to easily embed the Editoria11y and Sa11y tools into websites built with Kirby 3. My original contribution is limited to making them available by use of a Kirby snippet in a template.

Editoria11y is maintained by John Jameson and is provided to the community thanks to the Digital Accessibility initiatives at Princeton University's Office of Web Development Services. It started as a fork of Sa11y created by Digital Media Projects, Computing and Communication Services (CCS) at Ryerson University in Toronto, Canada and lead and maintained by Adam Chaboryk, which has since evolved into version 2. Sa11y itself began as a fork of Tota11y by Khan Academy, and uses FontAwesome icons and jQuery.

License

Kirby3 A11yprompter is open-sourced software licensed under the GPLv2 license, to comply with the original GPLv2 license of Editoria11y. Sa11y and Tota11y are licensed under the MIT license, which permits its inclusion in GPLv2-licensed software.

Copyright © 2021 Sebastian Greger

It is discouraged to use this plugin in any project that promotes the destruction of our planet, racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.

You might also like...
A Frankenstein's monster: Kirby inside of Laravel.

A Kirby-Laravel Starter Kit This is an experimental starter kit for using Kirby within Laravel (a little like Statamic). In my limited experience it r

Plugin for Kirby that allows you to load assets generated by Vite.

Kirby Vite Plugin Plugin for Kirby that allows you to load assets generated by Vite. In development mode, assets are loaded from Vite's development se

🦭 Kirby, but headless only – KQL with bearer token, Express-esque middlewares & more

Kirby Headless Starter ℹ️ Send a Bearer test authorization header with a request to the live playground to test this headless starter. This starter ki

Kirby 3 Plugin for running jobs like cleaning the cache from within the Panel, PHP code, CLI or a cronjob

Kirby 3 Janitor Kirby 3 Plugin for running jobs. It is a Panel Button! It has jobs build-in for cleaning the cache, sessions, create zip-backup, pre-g

Enhance product data quality and streamline content creation with the Pimcore and ChatGPT integration.
Enhance product data quality and streamline content creation with the Pimcore and ChatGPT integration.

chatgpt-pimcore Enhance product data quality and streamline content creation with the Pimcore and ChatGPT integration. Overview The integration of Pim

Calibre OPDS (and HTML) PHP Server : web-based light alternative to Calibre content server / Calibre2OPDS to serve ebooks (epub, mobi, pdf, ...)

COPS COPS stands for Calibre OPDS (and HTML) Php Server. See : COPS's home for more details. Don't forget to check the Wiki. Why ? In my opinion Calib

Cbe frontauth - A Textpattern plugin to manage backend connections from frontend and protect content from non-logged users

cbe_frontauth This client-side plugin lets your users (or you) manage backend connection from frontend, i.e. connect and disconnect as they (you) woul

This module integrates Silverstripe CMS with Google Translate API and then allows content editors to use automatic translation for every translatable field.
This module integrates Silverstripe CMS with Google Translate API and then allows content editors to use automatic translation for every translatable field.

Autotranslate This module integrates Silverstripe CMS with Google Translate API and then allows content editors to use automatic translation for every

Commands and implementations for common tasks for the PHP Content Repository (PHPCR) API.

PHPCR Utilities Commands and implementations for common tasks for the PHP Content Repository (PHPCR) API. If you are using or implementing PHPCR you p

Releases(v1.0.0)
Owner
Sebastian Greger
Sociologist and Interaction Designer
Sebastian Greger
This Kirby V3 Plugin brings snippets and blueprints together in one place. It includes useful tools that completely changing the way you work with Kirby: Fast and well organized.

Kirby Components Overview Do you love to make awesome projects with Kirby CMS? Do you also find it difficult to switch between snippets and blueprints

Roman Gsponer 6 May 31, 2023
A simple wrapper around vlucas' PHP dotenv library for Kirby CMS.

kirby-phpdotenv A simple wrapper around vlucas' PHP dotenv library for Kirby CMS. Why? I've been using .env in my Kirby projects for a while, but I go

Steve Jamesson 5 Feb 6, 2020
Simple Online Automated Provision

Simple Online Automated Provisioning Simply put, SOAP automates PXE network booting and OS installation. With SOAP, you can submit the network informa

xTom 4 Dec 9, 2021
Phalcon Mooc an example API + Front End with automated tests

NovaMooc - a Phalcon project A Mooc project developed with Phalcon, a PHP framework. Key Features • How To Use • Contributing • Credits • License Key

Les Enovateurs 19 Dec 4, 2022
This plugin allows you to create many-to-many relationships between pages in Kirby and synchronizes them on both sides.

Kirby 3 Many To Many Field This plugin allows you to create many-to-many relationships between pages in Kirby.

Jonas Holfeld 41 Nov 19, 2022
Kirby plugin to visually show hidden characters in all kind of input fields and their previews.

Kirby Hidden Characters Kirby plugin to visually show hidden characters in all kind of input fields and their previews. This includes white spaces and

Jakob Grommas 21 Oct 17, 2022
Kirby Janitor job for staging

Simple staging Janitor jobs Plugin for very simple staging setup for https://github.com/bnomei/kirby3-janitor/ (required). Beta quality - use at your

Florian Karsten 8 Nov 27, 2022
Color-managed thumbnails for Kirby 3

ImageKit for Kirby 3 This is not directly related for ImageKit for Kirby 2, but based on the same idea of improving Kirby’s built-in image processing

Fabian Michael 13 Nov 21, 2022
Helper to automatically load various Kirby extensions in a plugin

Autoloader for Kirby Helper to automatically load various Kirby extensions in a plugin Commerical Usage This package is free but if you use it in a co

Bruno Meilick 13 Nov 9, 2022
Add information about PGP public keys on upload in Kirby v3

Kirby3 GnuPG This plugin adds information about PGP public keys on upload, using gpg binary (which needs to be installed for this to work). Getting st

Fundevogel 2 Oct 11, 2021