ucfopen / UDOIT

The Universal Design Online content Inspection Tool, or UDOIT (pronounced, “You Do It”) enables faculty to identify accessibility issues in their Learning Management System. It will scan a course, generate a report, and provide resources on how to address common accessibility issues.
GNU General Public License v3.0
108 stars 65 forks source link

High False Positive Rate with Avoid Using Styles for Document Structure #923

Closed SavvyDolphin77 closed 4 months ago

SavvyDolphin77 commented 11 months ago

For version 3.3.2

Description: UDOIT seems to falsely report the Avoid Using Styles for Document Structure on text that is bolded but not a heading.

Suggested/Potential Idea To Fix: Have a check to see if the word count is too long maybe greater than 16 characters (as that would not be any reasonable heading) and if so does not mark the text as a header that should not be bolded. I do not know the inner workings of UDOIT as much so this may not be applicable but is just a thought to consider.

Step by Step to Reproduce:

Noticed that it is semi-iffy on this after further testing for this bug report. Some instances it won't detect, other times it well. Sometimes if the text is inside a span, it gets flagged and follows same issue here. Other times like in the Example HTML provided it does not. Recommended when fixing an enhance dive into different test cases to see what is trigger it as the one example provide may not cover all false reports that this is affecting.

Example HTML:

<h2>This is A Header</h2>
<p><strong><span>This is some text that I have bolded because its really important! But unfortunately not as important as a header.</span><br /><br /></strong>text text text text text text text text</p>
<p>&nbsp;</p>
<h3>Header 236</h3>
<p><strong>test text more text more text more text more text more text more text more text</strong></p>

If you create a new page, copy and paste the code into the HTML editor, then save, publish, and run in UDOIT it should be flagged or at least was on my end. Again, does not cover all possibilities that UDOIT incorrectly flags bolded text.

The "test text more text more text more text more text more text more text more text" should be falsely reported by UDOIT with the Avoid Using Styles For Document Structure using the above HTML code in a page and as seen in the screenshot below.

Screenshot 2023-10-12 at 16 23 52

Severity: Low/Medium (can be worked around by marking as resolved, but still should not be the desired output of UDOIT) Scale: Large, affects all users with html that has bolded text that is not a heading.

taheralfayad commented 5 months ago

The reason that this particular error happens is because UDOIT treats <p> tags that only have text content in a <strong> tag as potentially a style for heading error. This is the code from phpa11y that performs the check.

phpally/src/Rule/ParagraphNotUsedAsHeader.php:

if (isset($p->nodeValue) && isset($p->firstChild->nodeValue)) {
    if (($p->nodeValue == $p->firstChild->nodeValue)
        && is_object($p->firstChild)
        && property_exists($p->firstChild, 'tagName')
        && in_array($p->firstChild->tagName, $this->head_tags)
    ) {
        $this->setIssue($p);
} 

Now this is a fair assumption for UDOIT to make, the chances of this actually being an error are high. But I think the description text in the modal should change to something that tells the user to verify that this is an error. @dmols Let me know of any thoughts that you have and we can move to change the description.