Skip to content

Instantly share code, notes, and snippets.

@thibaudcolas
Last active December 2, 2024 15:20
Show Gist options
  • Save thibaudcolas/cf8027ee7150d63fd59587f0795da864 to your computer and use it in GitHub Desktop.
Save thibaudcolas/cf8027ee7150d63fd59587f0795da864 to your computer and use it in GitHub Desktop.
Content checks notes

Content checks

Mapping accessibility errors to page fields

See wagtail/wagtail#10136.

Here is early R&D, rule-by-rule. At a high level, matching by element text feels possible in a wide number of cases but not all. An alternative would be to change the rendering of Wagtail content on sites to contain field marks (repurposing comments’ contentpath?)

empty-heading

  • In rich text: Possible by relying either on Draftail block key, or text of rich text elements before/after.
  • In Django fields: Impossible
  • In StreamField: Impossible unless we introduced a special HeadingBlock as a CharBlock derivative as a CMS feature. For a project-specific HeadingBlock: at least likely to be a required field.

heading-order

  • In rich text: Possible by relying on Draftail block key, or heading text.
  • In Django fields: Possible by text match.
  • In StreamField: Possible by text match. Would be helped by a custom HeadingBlock.

p-as-heading

  • In rich text: Possible by relying on Draftail block key, or element text match.

Empty button, link, frame

  • Everywhere: likely too hard to do reliably.

Table validation issues

  • TableBlock: likely possible via text match, or could output a block key in our table template
  • TypedTableBlock: perhaps possible via text match, or could output a block key in our table template

Custom link text rule

  • In rich text: Possible by relying on Draftail block key, or element text match.
  • In Django fields: Possible by text match.
  • In StreamField: Possible by text match.

Custom image alt text rule

  • In rich text: Possible by relying on Draftail block key, or alt text / other attributes match
  • In Django fields: Possible by alt text / other attributes match
  • In StreamField: Possible by alt text / other attributes match
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment