Welcome! » Log In » Create A New Profile

Add support for scope attribute to comply with accessiblity (WCAG, section 508, etc..)

Posted by thekevinday 

HTML Purifier is stripping out 'scope' attribute from th and table td tags. This causes my content to fail accessibility compliance.

I have made the following patch allows me to maintain the scope attribute:

diff --git a/htmlpurifier/library/HTMLPurifier/HTMLModule/Tables.php b/htmlpurifier/library/HTMLPurifier/HTMLModule/Tables.php
index f314ced..e28a456 100644
--- a/htmlpurifier/library/HTMLPurifier/HTMLModule/Tables.php
+++ b/htmlpurifier/library/HTMLPurifier/HTMLModule/Tables.php
@@ -37,6 +37,7 @@ class HTMLPurifier_HTMLModule_Tables extends HTMLPurifier_HTMLModule
                 'abbr'    => 'Text',
                 'colspan' => 'Number',
                 'rowspan' => 'Number',
+                'scope'   => 'Text',
             ),
             $cell_align
         );

Please consider committing this patch or something similar that allows for 'scope' attribute in the th and td tags.

References:
Re: Add support for scope attribute to comply with accessiblity (WCAG, section 508, etc..)
December 25, 2011 09:58AM

Done! I opted for a more restrictive enumeration of row, col, rowgroup and colgroup.

Sorry, you do not have permission to post/reply in this forum.