Browse Source

Update example for customizing "p-as-heading" check (#12763)

Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
Cynthia Kiser 2 months ago
parent
commit
f3d1765353
4 changed files with 19 additions and 13 deletions
  1. 2 0
      CHANGELOG.txt
  2. 15 12
      docs/advanced_topics/accessibility_considerations.md
  3. 1 1
      docs/releases/6.3.3.md
  4. 1 0
      docs/releases/6.4.md

+ 2 - 0
CHANGELOG.txt

@@ -6,6 +6,7 @@ Changelog
 
 * Fix: Correctly place comment buttons next to date / datetime / time fields. (Srishti Jaiswal)
 * Fix: Reduce confusing spacing below StreamField blocks help text (Rishabh Sharma)
+* Docs: Update example for customizing "p-as-heading" accessibility check without overriding built-in checks (Cynthia Kiser)
 
 6.4 (xx.xx.xxxx) - IN DEVELOPMENT
 ~~~~~~~~~~~~~~~~
@@ -86,6 +87,7 @@ Changelog
  * Docs: Fix Django HTML syntax formatting issue on the documents overview page (LB (Ben) Johnston)
  * Docs: Separate virtual environment creation and activation steps in tutorial (Ankit Kumar)
  * Docs: Update tutorial to use plain strings in place of `FieldPanel` / `InlinePanel` where appropriate (Unyime Emmanuel Udoh)
+ * Docs: Update example for customizing "p-as-heading" accessibility check without overriding built-in checks (Cynthia Kiser)
  * Maintenance: Close open files when reading within utils/setup.py (Ataf Fazledin Ahamed)
  * Maintenance: Avoid redundant `ALLOWED_HOSTS` check in `Site.find_for_request` (Jake Howard)
  * Maintenance: Update `CloneController` to ensure that `added`/`cleared` events are not dispatched as cancelable (LB (Ben) Johnston)

+ 15 - 12
docs/advanced_topics/accessibility_considerations.md

@@ -153,19 +153,22 @@ from wagtail.admin.userbar import AccessibilityItem
 
 
 class CustomAccessibilityItem(AccessibilityItem):
-    axe_custom_checks = [
-        {
-	    # Flag heading-like paragraphs based only on font weight compared to surroundings.
-            "id": "p-as-heading",
-            "options": {
-                "margins": [
-                    { "weight": 150 },
-                ],
-                "passLength": 1,
-                "failLength": 0.5
+    def get_axe_custom_checks(self, request):
+        checks = super().get_axe_custom_checks(request)
+        # Flag heading-like paragraphs based only on font weight compared to surroundings.
+        checks.append(
+            {
+                "id": "p-as-heading",
+                "options": {
+                    "margins": [
+                        { "weight": 150 },
+                    ],
+                    "passLength": 1,
+                    "failLength": 0.5
+                },
             },
-        },
-    ]
+        )
+        return checks
 
 
 @hooks.register('construct_wagtail_userbar')

+ 1 - 1
docs/releases/6.3.3.md

@@ -19,4 +19,4 @@ depth: 1
 
 ### Documentation
 
- * ...
+ * Update example for customizing "p-as-heading" accessibility check without overriding built-in checks (Cynthia Kiser)

+ 1 - 0
docs/releases/6.4.md

@@ -96,6 +96,7 @@ depth: 1
  * Fix Django HTML syntax formatting issue on the [documents overview](documents_overview) page (LB (Ben) Johnston)
  * Separate virtual environment creation and activation steps in tutorial (Ankit Kumar)
  * Update tutorial to use plain strings in place of `FieldPanel` / `InlinePanel` where appropriate (Unyime Emmanuel Udoh)
+ * Update example for customizing "p-as-heading" accessibility check without overriding built-in checks (Cynthia Kiser)
 
 ### Maintenance