css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <main>
  <h1>HTML Buddies: <code>&lt;dt&gt;</code> & <code>&lt;dd&gt;</code></h1>

  <p>
    Description (nee definition) lists are a bit of an outlier in HTML lists. Like ordered and unordered lists, they can be nested. Unlike ordered and unordered lists, they are made up of key/value pairs.
  </p>

  <p>
    They are also exposed to assistive technology differently and, depending on screen reader chosen, sometimes do not convey what they are.
  </p>

  <dl>
    <dt>NVDA:</dt>
    <dd>Announces as <q>list</q>,</dd>
    <dd>Counts both <code>&lt;dt&gt;</code> & <code>&lt;dd&gt;</code> when providing the list item count,</dd>
    <dd>Skips <code>&lt;dd&gt;</code>s when navigating by list item (<kbd>I</kbd>).</dd>
    <dt>JAWS:</dt>
    <dd>Announces as <q>definition list</q>,</dd>
    <dd>Counts only <code>&lt;dt&gt;</code>s when providing the list item count,</dd>
    <dd>Skips <code>&lt;dd&gt;</code>s when navigating by list item (<kbd>I</kbd>).</dd>
    <dt>Voiceover (macOS):</dt>
    <dd>Announces as <q>description list</q>,</dd>
    <dd>Counts both <code>&lt;dt&gt;</code> & <code>&lt;dd&gt;</code> when providing the list item count,</dd>
    <dt>Voiceover (iOS):</dt>
    <dd>Does not announce the presence of a list,</dd>
    <dd>Does not provide any count nor convey that the user is in a list,</dd>
    <dd>When navigating by lists, it is not recognized.</dd>
    <dt>TalkBack (Android):</dt>
    <dd>Announces as <q>list</q>,</dd>
    <dd>Counts both <code>&lt;dt&gt;</code> & <code>&lt;dd&gt;</code> when providing the list item count,</dd>
    <dd>Skips <code>&lt;dd&gt;</code>s when navigating by list item.</dd>
    <dd>When focus is on a <code>&lt;dd&gt;</code>, after speaking the text it adds <q>definition</q>.</dd>
    <dt>Narrator</dt>
    <dd>Announces as <q>list</q>,</dd>
    <dd>Counts both <code>&lt;dt&gt;</code> & <code>&lt;dd&gt;</code> when providing the list item count,</dd>
    <dd>There is no option to navigate by list or list item.</dd>
  </dl>
  
  <p>
    Of course, once you start messing with CSS display properties, browsers dump all the information and pass along nothing to assistive technology. You can add it back with ARIA, but ARIA has no roles that map to the description list, so you may have to assign it a regular list role. See the links below for more information.
  </p>

  <h2>References</h2>

  <ul>
    <li>
      While not explicitly about lists, my post <a href="http://adrianroselli.com/2018/02/tables-css-display-properties-and-aria.html"><cite>Tables, CSS Display Properties, and ARIA</cite></a> demonstrates how easily you can accidentally strip the semantics of an element.
    </li>

    <li>
      If you need to add ARIA to your lists due to adding CSS display properties, you can retrofit the list function from my post <a href="http://adrianroselli.com/2018/05/functions-to-add-aria-to-tables-and-lists.html"><cite>Functions to Add ARIA to Tables and Lists</cite></a>.
    </li>

    <li>
      Scott O’Hara walks us through how screen readers announce the other list types in his post <a href="https://www.scottohara.me/blog/2018/05/26/aria-lists.html"><cite>ARIA Lists</cite></a>.
    </li>

    <li>
      This pen is for the May 2018 week 4 CodePen challenge, <a href="https://codepen.io/challenges/2018/may#cpc-dt-dd">HTML Buddies</a>.
    </li>
    
    <li>
      See <a href="http://adrianroselli.com/2018/06/codepen-html-buddies-challenge.html" target="_top">all four of my pens for this challenge</a> at my site with additional context.
    </li>
  </ul>

</main>
            
          
!
            
              @import url("https://fonts.googleapis.com/css?family=Lato:400,700|VT323");

body {
  background-color: #aeaf8c;
  color: #333;
  font-family: Lato, Arial, sans-serif;
  padding: 0;
  margin: 0;
  line-height: 1.5;
}

li:not(:first-of-type) {
  margin-top: 1em;
}

code {
  font-family: "VT323", "Courier New", Courier, monospace;
  font-size: 110%;
  font-weight: normal;
  font-variant-ligatures: none;
  padding: 0.05em 0.25em;
  background-color: rgba(255, 255, 255, 0.75);
  border-radius: 0.5em;
  box-decoration-break: slice;
}

main {
  display: block;
  box-sizing: border-box;
  width: 90%;
  margin: 1em auto;
  padding: 1em 2em;
  color: #000;
  background-color: rgba(255, 255, 255, 0.8);
  border: 0.07em solid rgba(0, 0, 0, 0.5);
  border-radius: 0.5em;
}

kbd {
  border: 0.07em solid #aaa;
  border-radius: 0.3em;
  box-shadow: 0.1em 0.2em 0.2em rgba(0, 0, 0, 0.25);
  background-color: #f9f9f9;
  background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee);
  padding: 0.1em 0.3em;
  font-family: Courier, "Courier New", monospace;
  font-size: 90%;
  color: #000;
  line-height: 1;
}

dt {
  font-weight: bold;
}

dd {
  text-indent: -1em;
}

dt:not(:first-of-type) {
  margin-top: 1em;
}

dd:not(:first-of-type) {
  margin-top: 0.25em;
}

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console