Description
While writing/editing rules, I feel I spend a lot of time curating the list of references, and notably copying some from other rules (I can't count how often I've copied the ref for "flat tree"…) And we seem to end up with fairly long list of refs in modern rules… (I'm having ~20-25 refs in some of the rules for Bypass blocks…) And these lists are often poorly curated (typically, not ordered which result in adding the same ref twice because the first occurrence wasn't found).
We might benefit from having a shared list of references that would be automatically added to each markdown file (rule and def) before converting to HTML (the HTML conversion takes care of killing the unused ones). This list would contain both our own definitions (and this can also be automatically generated from the individual files metadata), and some of the most commonly used external definition ("flat tree" comes to mind, but there are many others). Rarely used refs could be kept in the individual files if wanted.
Benefits:
- Less time spend in curating reference list in each file.
- Easier to maintain consistency in references (notably, HTML specs are sometimes linked to the
/multipage
doc and sometimes to the single page one). - Easier to maintain consistency in links' titles (the quoted string at the end of references). See Unifying titles of links in reference list #1297.
- Possibility to gather a "used in rules" list for external references, like we have for our own defs. (already possible now but without a single name for these, this is mostly pointless)
Challenges:
- Need a bit of coding for automating this. Especially if we want to automate the inclusion of our definition.
- Harder to check that all refs used in a rule exist, but should be OK-ish by injecting the list beforehand.
- Maintaining a single long list of refs. Need a bit of guidance and a lot of discipline (similar to our spelling exception list), plus maybe some tests to prevent adding duplicate refs, … Also, will create a bit more merge conflicts on secondary files.
- Loosing a bit of locality. Now we need to check the refs list to review a rule.
Concretly:
- Based on definitions meta-data, we auto-generate a file containing:
[accessible name]: #accessible-name 'Definition of Accessible Name'
[included in the accessibility tree]: #included-in-the-accessibility-tree 'Definition of Included in the Accessibility Tree'
…
- We maintain by hand a file containing:
[document]: https://dom.spec.whatwg.org/#concept-document 'DOM definition of Document'
[sc241]: https://www.w3.org/TR/WCAG21/#bypass-blocks 'Success Criterion 2.4.1 Bypass Blocks'
[sequential focus navigation]: https://html.spec.whatwg.org/multipage/interaction.html#sequential-focus-navigation 'HTML definition of Sequential Focus Navigation'
…
this file needs curating, so probably sectioning and keeping alphabetical order, and testing if the same key is used twice.
- Both files are automatically added at the end of each rule and definition file at build time.
- Now, rules can use
A [document][] with content [included in the accessibility tree][]
without needing to copy these references all over the place.