Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support expanded definition list rule in the WHATWG HTML spec which allows for divs as parents of dt/dds #262

Closed
Blackbaud-MattGregg opened this issue Dec 5, 2016 · 21 comments
Labels
fix Bug fixes rules Issue or false result from an axe-core rule

Comments

@Blackbaud-MattGregg
Copy link

I was wondering if the definition list rule would or should ever be expanded to the WHATWG HTML spec which seems to allow for divs as parents of dt/dds (https://html.spec.whatwg.org/multipage/semantics.html#the-dl-element) if screen readers/browsers support this (I don't know if they do)? I imagine the WCAG is strict to the W3C's HTML5 spec, but don't know for sure.

I've had this come up and trying to figure out how to avoid disabling this rule or find some other semantic markup for the relationships given the divs can't be changed.

@dylanb
Copy link
Contributor

dylanb commented Dec 8, 2016

@Blackbaud-MattGregg the WHATWG spec is a "living document", do you know what the support is from an accessibility perspective of definition lists with <div> children vs ones with just the dt or dd directly?

@Blackbaud-MattGregg
Copy link
Author

Blackbaud-MattGregg commented Dec 8, 2016

I can't say that I do though I'm not sure what you mean by "support from an accessibility perspective"...do you mean screenreaders can handle this without issues or something else?

Mozilla has it in their HTML reference https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dl#Wrapping_name-value_groups_in_&lt;div&gt;_elements and stated at least at one point they follow WHATWG when they differ (https://developer.telerik.com/featured/w3c-vs-whatwg-html5-specs-differences-documented/). However, I don't know what is really implemented from an accessibility perspective or browser accessibility tree.

@dylanb
Copy link
Contributor

dylanb commented Dec 8, 2016

We need to verify equivalent semantic exposure by all browsers on all platforms in the accessibility tree.

I have verified Safari: OS X + VoiceOver

@marcysutton @WilcoFiers can you verify other platforms?

@Blackbaud-MattGregg
Copy link
Author

Gotcha. I'm not sure what you do to verify, but let me know if there is something I could chip in on. On Mac Chrome when I look at two version of the a11y in the inspector this is what is shows

  • WebArea "asdf"
    • DescriptionList
      • DescriptionListTerm
      • DescriptionListDetail

then with div

  • WebArea "asdf"
    • DescriptionList
    • Ignored
      • DescriptionListTerm
      • DescriptionListDetail

The ignored div properties read out as "Accessibility node not exposed Element not interesting for accessibility."

@dylanb
Copy link
Contributor

dylanb commented Dec 9, 2016

I did three things to validate support:

  1. Does the browser leave the DIV in the DOM when rendered? (using the developer tools inspector)
  2. Does the screen reader announce the element the same way? (sometimes this means no announcement at all for definition lists - but for OSX Safari VO, it announces the number of items in the list as a whole)
  3. Does the accessibility tree look the same?

In your example, it would be failing number 3 - but this Chrome on Mac is not a supported platform anyway, so that does not matter. Also having the only difference be "ignored" would be ok as long as the other two tests pass.

Important are:

Windows, IE, JAWS 18
Windows, Firefox, NVDA

iOS, Safari, VO

extra credit

Android, Firefox, Talkback

image

@marcysutton marcysutton changed the title Question: definition list rule expanded to the WHATWG HTML spec which allows for divs as parents of dt/dds Support expanded definition list rule in the WHATWG HTML spec which allows for divs as parents of dt/dds Apr 26, 2017
@web-bert
Copy link

Hi, any ideas when this will get added? Is there a way I disable this rule for now as it's making my tests fail?

@glouischandra
Copy link

+1 ping on this as well. We also noticed this in our project. If there's gonna be a timeline on when the rule will be updated it will be much appreciated :)

@WilcoFiers
Copy link
Contributor

@glouischandra Appreciate the ping. We need to properly test that this works well in assistive technologies as Dylan suggested. If you can provide the test data, that'd be much appreciated.

@WilcoFiers WilcoFiers added the help wanted We welcome PRs or discussions for issues marked as help wanted label Oct 8, 2017
@Malvoz
Copy link
Contributor

Malvoz commented Dec 7, 2017

I do not currently use any accessibility inspector, however I do have ChromeVox (v. 53.0.2784.5) installed on my Windows pc, and the screen reader reads out the <dt>s and <dd>s all the same, with or without wrapping <div>s.

HTML structure for the tests:

Classic <dl> without <div>s:

<!doctype html>
<html lang="en">
<title>document title</title>
<body>
  <dl>
    <dt>description term</dt>
    <dd>description definition</dd>
  </dl>
</body>
</html>

<div> wrapping group of <dt>/<dd>:

<!doctype html>
<html lang="en">
<title>document title</title>
<body>
  <dl>
    <div>
      <dt>description term</dt>
      <dd>description definition</dd>
    </div>
  </dl>
</body>
</html>

Result:

ChromeVox reads out the description list and its children as it should - with or without wrapping <div>.

However I noticed when I updated the page in the browser, ChromeVox in both cases read only the <title> and <dd>, not the <dt>. This might be a ChromeVox bug, though I should add I'm not an avid screen reader user and I haven't read the ChromeVox manual..

@WilcoFiers

@WilcoFiers
Copy link
Contributor

Thanks for the test. We'll need results from the screen readers Dylan mentioned above:

Windows, IE, JAWS 18
Windows, Firefox, NVDA
iOS, Safari, VO

@Malvoz
Copy link
Contributor

Malvoz commented Dec 21, 2017

@WilcoFiers
@dylanb

Did a test with NVDA 2017.4 on Windows, Firefox 57.0.2 using the exact same HTML structure as above.

In both cases the document was read out the same, and the NVDA Speech viewer logged:

document title
list with 2 items
description term
description definition

The <div> element was visible in the DOM as expected.

@WilcoFiers
Copy link
Contributor

Excellent. VoiceOver seems okay with it as well.

@marcysutton
Copy link
Contributor

Does anyone have an Android device they can test with TalkBack? In iOS Safari+Voiceover, none of the roles are read aloud for me when I swipe through, just the content ("description term", "description definition"). Adding a DIV doesn't seem to make a difference.

@dylanb
Copy link
Contributor

dylanb commented Apr 1, 2018

@marcysutton ask @chriscm2006 if he can do the test or give @isner a device to test in A2

@Malvoz
Copy link
Contributor

Malvoz commented Apr 18, 2018

@marcysutton @dylanb

I tested the markup on my Samsung Galaxy S8, Android 8.0.0 with Google Chrome 65.0.3325109 using Voice Assistant.

Results were consistent with or without <div> wrappers.
When I loaded the test page, Voice Assistant read out "document title", but did not read out "description term" and "description definition" unless I pressed the text.

Also <dd>description definition</dd> was actually read out "description definition definition".

I believe there are issues in general using Voice Assistant, even reaching something simple as
<p>text <a href="#">anchor</a> text</p> it would read out "text text", in other words completely ignoring the anchor text (this was tested on a blog post with natural text and an achor with a real link destination, if that matters).

Conclusion

No difference in how <dt>|<dd> was treated wether it had a <div> wrapper or not. Voice assistant probably has major issues on its own.

@WilcoFiers
Copy link
Contributor

We checked internally as well and have confirmed the findings. We should allow this in axe-core.

@kensgists
Copy link

Thumbs up on this one, as well. Interesting finding: The only way NVDA 2017.2 through 2018.1 correctly report the number of groupings in the list (dt + 1 or more dd) is if you use divs as containers for the groupings.

My results:

  • JAWS 2018 + IE 11: correct enumeration with our without
  • NVDA 2018.1 + FF 61: correct enumeration ONLY if you use divs, otherwise treats each dt or dd as a list item.
  • iOS 11.2 VO + Safari: No support for description lists, regardless of nesting (boo! bad Apple)
  • Mac OS 10.13 High Sierra VO version 8 + Safari (latest): Regardless of div nesting, when entering list correct number of item grouping reported. Then when browsing, each dt or dd is reported as an individual list item.
  • Android 8.1 with Talkback 6.1 + Chrome 66: Reads each dd prepended with word "definition" regardless of div nesting.

In addition, it is worth noting that HTML 5 now explicitly allows using divs to group:
https://www.w3.org/TR/html/grouping-content.html#the-dl-element

@WilcoFiers WilcoFiers added fix Bug fixes rules Issue or false result from an axe-core rule and removed help wanted We welcome PRs or discussions for issues marked as help wanted labels Jul 3, 2018
WilcoFiers added a commit that referenced this issue Aug 22, 2018
Allow div elements to group content inside of dl elements.

Closes #262

## Reviewer checks

**Required fields, to be filled out by PR reviewer(s)**
- [x] Follows the commit message policy, appropriate for next version
- [x] Has documentation updated, a DU ticket, or requires no documentation change
- [x] Includes new tests, or was unnecessary
- [x] Code is reviewed for security by: Jey
@delrueba
Copy link

delrueba commented Sep 4, 2018

I'm still getting these errors:

- <dl> elements must only directly contain properly-ordered <dt> and <dd> groups, <script> or <template> elements
- <dt> and <dd> elements must be contained by a <dl>

On HTML I've plucked from the test files:
<dl id="target"><div role="listitem"><dt>An item</dt><dd>A list</dd></div></dl>

I'm using gulp-axe-webdriver with axe-core 3.1.1.
My A11yCheckOptions are

      a11yCheckOptions: {
        runOnly: {
          type: 'tag',
          values: ['wcag2a', 'wcag2aa']
        }
      }

I noticed some changes from this issue were overwritten and are not included in the 3.1.1 release.
https://github.com/dequelabs/axe-core/commits/3.1.1/lib/checks/lists/only-dlitems.js

Could this be the issue? Or am I missing something in my setup?

Thanks for your help!

@kensgists
Copy link

Thumbs upping this one, again.

The fix seems to have been reverted. As of axe-core 3.1.2 an dl > div > dt+dd still causes a violation of "dl-item" (though not "definition-list").

@jebw
Copy link

jebw commented Jul 23, 2019

We're hitting this issue as well

Downloaded Axe for the first time today - release 3.8.0 - and its reporting errors with the dl > div > dt structure

@straker
Copy link
Contributor

straker commented Aug 5, 2019

@jebw @kensgists Sorry it's taken awhile to respond. If you're still seeing issues please open a new issue so we can track this better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fixes rules Issue or false result from an axe-core rule
Projects
None yet
Development

No branches or pull requests