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

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.

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

              
                <div>
        <h1>
          No focusable element test
        </h1>
        <p>
          <strong>This test only works in browsers that have implemented the dialog element (and if necessary, a flag has been turned on to have it render)</strong>.
        </p>
        <p>
          This test is to show what happens if a dialog element has no focusable content, but focus is set to the dialog itself (using "invalid" tabindex=-1 on the dialog)
        </p>
     

      <p>
        <button onclick="showDialog(myDialog)">
          Open my dialog!
        </button>
      </p>

      <p>
        <button onclick="showDialog(myOtherDialog)">
          Open long dialog!
        </button>
      </p>

      <dialog id="my_dialog" tabindex=-1>
        <h1>My heading</h1>
        <p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p>
      </dialog>

      <dialog id="my_other_dialog" tabindex=-1>
        <h1>My heading</h1>
        <p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p><p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p><p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p><p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p><p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p><p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p><p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p><p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p><p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p><p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p><p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p><p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p><p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p><p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p><p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p><p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p><p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p><p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p><p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p><p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p><p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p><p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p><p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p><p>
          Nothing to focus here
        </p>
        <p>
          Nothing to focus at all.
        </p>
      </dialog>
  

	
<h2>Results</h2>
	<p>With <strong>Firefox and Chromium browsers paired with JAWS</strong>, either the heading will be announced, or the focused dialog will announce as "modal dialog".   Pressing down arrow will begin announcing the content of the dialog.  The heading can be skipped over by JAWS, but that seems something JAWS should fix.
<p>
	<strong>Narrator with Edge</strong> will announce "modal dialog" when focusing the dialog element.  For the long dialog test, Narrator will beging reading the contents of the dialog from start to end.
<p>
	<strong>Firefox and Chromium browsers</strong> with NVDA will start announcing the content of the dialog from start to finish.  

	<p>
		<strong>Safari Tech Preview and VoiceOver</strong> will immediately push VO focus to the heading of the dialog, announcing its contents and however many other items are in the "group" (odd to not say dialog... but looking in Safari's dev tools Node pannel > Accessibility, the dialog presently returns "no matching ARIA role", so maybe that's why?)

		<hr>
	
	<p>You can also check out <a href="https://scottaohara.github.io/testing/html-dialog/just-dialog.html">this dialog comparison test</a> for different behaviors when a focusable element or the dialog element itself is initially focused.</p>
		
		
</div>

              
            
!

CSS

              
                body > div {
	max-width: 35em;
	padding: 1.5em;
}
              
            
!

JS

              
                
const myDialog = document.getElementById('my_dialog');
const myOtherDialog = document.getElementById('my_other_dialog');

const showDialog = function ( el ) {
	el.showModal();
	el.focus();
}
const closeDialog = function ( el ) {
	el.close();
}
              
            
!
999px

Console