-
Notifications
You must be signed in to change notification settings - Fork 21
Preventing accessibility issues before publishing #217
Description
There are a number of common accessibility issues which are frequently included in our documents.
They are currently being published without any automatic detection, and publishers are unaware that they are inadvertently publishing inaccessible documents.
We are hoping to add some new functionality to Govspeak to allow certain accessibility issues to be detected and the user alerted at the earliest possible opportunity.
How
Our proposed approach is to add an AccessibilityValidator class similar to the existing HtmlValidator. The AccessibilityValidator will have access to a range of additional methods to parse submitted GovSpeak and detect accessibility issues.
The AccessibilityValidator will be able to accept arguments to allow certain rules to be enabled or disabled.
Consuming applications that wish to use the AccessibilityValidator will create their own interface similar to Whitehall's SafeHtmlValidator, and any models can then set their required accessibility rules to validate against.
validates_with AccessibilityValidator, attribute: :body, accessibility_rules: [:foo, :bar]
Should an attribute fail any of the rules, a standard Rails validation error will then be displayed upon attempting to save, allowing the user to correct the issue and prevent any further accessibility issues being published.
Request
Please ask any questions or point out any concerns or issues about this approach.