Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                [[[https://codepen.io/acordova/pen/JzoBwQ]]]

<div class="container">
  <h1 class="slds-text-heading_large pb">
    Ways to Announce Menu Sub Headers
  </h1>
  
  <p class="pv">
    Screen readers don't announce our menu subheadings b/c there's currently no aria recommendation for how to do it.
  </p>
  
  <div class="grid">
     <div>
       <h2 class="slds-text-heading_small pb">Current SLDS Implementation</h2>
       <div class="slds-dropdown-trigger slds-dropdown-trigger_click slds-is-open">
         <button class="slds-button slds-button_icon slds-button_icon-border-filled" aria-haspopup="true">
           <svg class="slds-button__icon" aria-hidden="true">
             <use xlink:href="#down"></use>
           </svg>
           <span class="slds-assistive-text">Show More</span>
         </button>
         <div class="slds-dropdown slds-dropdown_left slds-dropdown_small">
           <ul class="slds-dropdown__list" role="menu" aria-label="Show More">
             <li class="slds-dropdown__header slds-truncate" title="Menu Sub Heading" role="separator">
               <span>Menu Sub Heading</span>
             </li>
             <li class="slds-dropdown__item" role="presentation">
               <a href="javascript:void(0);" role="menuitem" tabindex="0">
                 <span class="slds-truncate">Menu Item One</span>
               </a>
             </li>
             <li class="slds-dropdown__item" role="presentation">
               <a href="javascript:void(0);"tabindex="-1">
                 <span class="slds-truncate" title="Menu Item Two">Menu Item Two</span>
               </a>
             </li>
             <li class="slds-dropdown__header slds-truncate" role="separator">
               <span>Menu Sub Heading</span>
             </li>
             <li class="slds-dropdown__item" role="presentation">
               <a href="javascript:void(0);" role="menuitem" tabindex="-1">
                 <span class="slds-truncate">Menu Item One</span>
               </a>
             </li>
             <li class="slds-dropdown__item" role="presentation">
               <a href="javascript:void(0);" role="menuitem" tabindex="-1">
                 <span class="slds-truncate">Menu Item Two</span>
               </a>
             </li>
           </ul>
          </div>
        </div>
      </div>
    <div>
      <h2 class="slds-text-heading_small pb">With aria-label on the Separator</h2>
      <div class="slds-dropdown-trigger slds-dropdown-trigger_click slds-is-open">
      <button class="slds-button slds-button_icon slds-button_icon-border-filled" aria-haspopup="true">
        <svg class="slds-button__icon" aria-hidden="true">
          <use xlink:href="#down"></use>
        </svg>
        <span class="slds-assistive-text">Show More</span>
      </button>
      <div class="slds-dropdown slds-dropdown_left slds-dropdown_small">
        <ul class="slds-dropdown__list" role="menu" aria-label="Show More">
          <li aria-label="Menu Sub Heading" class="slds-dropdown__header slds-truncate" role="separator">
            <span>Menu Sub Heading</span>
          </li>
          <li class="slds-dropdown__item" role="presentation">
            <a href="javascript:void(0);" role="menuitem" tabindex="0">
              <span class="slds-truncate">Menu Item One</span>
            </a>
          </li>
          <li class="slds-dropdown__item" role="presentation">
            <a href="javascript:void(0);" role="menuitem" tabindex="-1">
              <span class="slds-truncate">Menu Item Two</span>
            </a>
          </li>
          <li aria-label="Menu Sub Heading" class="slds-dropdown__header slds-truncate" role="separator">
            <span>Menu Sub Heading</span>
          </li>
          <li class="slds-dropdown__item" role="presentation">
            <a href="javascript:void(0);" role="menuitem" tabindex="-1">
              <span class="slds-truncate">Menu Item One</span>
            </a>
          </li>
          <li class="slds-dropdown__item" role="presentation">
            <a href="javascript:void(0);" role="menuitem" tabindex="-1">
              <span class="slds-truncate">Menu Item Two</span>
            </a>
          </li>
        </ul>
      </div>
    </div>
  </div>  
    <div>
      <h2 class="slds-text-heading_small pb">With labelled groups [best]</h2>
      <div class="slds-dropdown-trigger slds-dropdown-trigger_click slds-is-open">
      <button class="slds-button slds-button_icon slds-button_icon-border-filled" aria-haspopup="true">
        <svg class="slds-button__icon" aria-hidden="true">
          <use xlink:href="#down"></use>
        </svg>
        <span class="slds-assistive-text">Show More</span>
      </button>
      <div class="slds-dropdown slds-dropdown_left slds-dropdown_small">
        <ul class="slds-dropdown__list" role="menu" aria-label="Show More">
          <li class="slds-dropdown__header slds-truncate" role="separator">
            <span id="foo">Menu Sub Heading</span>
          </li>
          <div role="group" aria-labelledby="foo">
            <li class="slds-dropdown__item" role="presentation">
            <a href="javascript:void(0);" role="menuitem" tabindex="0">
              <span class="slds-truncate">Menu Item One</span>
            </a>
          </li>
          <li class="slds-dropdown__item" role="presentation">
            <a href="javascript:void(0);" role="menuitem" tabindex="-1">
              <span class="slds-truncate">Menu Item Two</span>
            </a>
          </li>
          </div>
          <li class="slds-dropdown__header slds-truncate" role="separator">
            <span id="bar">Menu Sub Heading</span>
          </li>
          <div role="group" aria-labelledby="bar">
             <li class="slds-dropdown__item" role="presentation">
            <a href="javascript:void(0);" role="menuitem" tabindex="-1">
              <span class="slds-truncate">Menu Item One</span>
            </a>
          </li>
          <li class="slds-dropdown__item" role="presentation">
            <a href="javascript:void(0);" role="menuitem" tabindex="-1">
              <span class="slds-truncate">Menu Item Two</span>
            </a>
          </li>
          </div>
        </ul>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                .container {
  background-color: white;
  width: 80%;
  margin: auto;
  padding: 2rem;
}

.pv {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.pb { padding-bottom: 1rem; }

.grid {
  display: grid;
  grid-template-columns: 33% 33% 33%;
}

              
            
!

JS

              
                $(document).ready(function() {
  
});
              
            
!
999px

Console