HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
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.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<header>
<h1>Details with revised explicit ARIA role tests</h1>
<p>Published: March 02, 2022</p>
<!-- <p>Last updated: April 01, 2022</p> -->
<p>Last Updated: June 17, 2022</p>
</header>
<details>
<summary>control</summary>
this serves as an unmodified control-case for comparative purposes.
<div role=note>
<p>Article and Region roles were chosen for testing as these would be reasonable roles to provide a details element. Providing a details a role of button, link, img, etc, would be nonsensical, and thus not tested.</p>
</div>
</details>
<details role=article aria-label=test open>
<summary>an example</summary>
This example has an article role.
</details>
<details role=article open>
<summary>an example</summary>
This example has an unnamed article role.
</details>
<details role=region aria-label=test2 open>
<summary>an example</summary>
this example has a region role.
</details>
<div class=results>
<div class=result-tables>
<table>
<caption>Details with revised role results</caption>
<tr>
<td></td>
<th>Narrator + Edge</th>
<th>macOS VoiceOver + Edge/Chrome</th>
<th>macOS VoiceOver + Firefox</th>
<th>macOS VoiceOver + Safari</th>
<th>iOS VoiceOver + Safari</th>
<th>NVDA + Edge/Chrome</th>
<th>NVDA + Firefox</th>
<th>JAWS + Edge/Chrome</th>
<th>JAWS + Firefox</th>
<th>TalkBack + Edge/Chrome</th>
<th>TalkBack + Firefox</th>
</tr>
<tr>
<th>Summary's role announced?</th>
<!-- narrator -->
<td>Yes</td>
<!-- mosvo -->
<td>Yes</td>
<td class=concern>No: summary's role dropped. If summary focued with VO cursor, announces 'clickable'</td>
<td>Yes</td>
<td class=concern>No. Same issues with unmodified details</td>
<!-- nvda -->
<td>Yes</td>
<td class=concern>No: summary's role dropped entirely.</td>
<!-- jaws -->
<td>Yes</td>
<td class=concern>"Button" role dropped if navigating by virtual cursor. If navigating by tab key, button role announced when focused. Otherwise, not discoverable by use of button quick nav, and summary text and details content flows together when using reading mode.</td>
<!-- tb -->
<td>Yes</td>
<td class=concern>No: "button" role dropped. See <a href="https://codepen.io/scottohara/pen/aaJXYG">test 0</a> for compartable results</td>
</tr>
<tr>
<th>Expand/Collapse state exposed?</th>
<!-- narrator -->
<td>Yes</td>
<!-- mosvo -->
<td>Yes</td>
<td class=concern>Poorly. Initial state will be exposed if navigated to via <kbd>tab</kbd> key while VO is enabled. </td>
<td>Yes</td>
<td class=concern>No. Same issues with unmodified details</td>
<!-- nvda -->
<td>Yes</td>
<td>Yes</td>
<!-- jaws -->
<td>Yes</td>
<td>Yes</td>
<!-- tb -->
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<th>details role exposed if changed?</th>
<!-- narrator -->
<td>Yes</td>
<!-- mosvo -->
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<!-- nvda -->
<td>Yes</td>
<td>Yes</td>
<!-- jaws -->
<td>Yes</td>
<td>Yes</td>
<!-- tb -->
<td>Yes - regions and articles accessible when navigating by landmarks.</td>
<td>Yes - region accessible when navigating by landmarks. Articles not exposed?</td>
</tr>
</table>
</div>
</div>
<!-- april note <p>note: chromium (exp found with jaws and nvda) seems to presently have a bug about announcing the expand/collapsed state of disclosure widgets. The current state was intermittently announced for both the control and example details/summary test cases.</p> -->
<!-- prevoius test results.
<div>
<table>
<col span=2 width=300px>
<caption>Summary element's role announcements by screen reader / browser combo</caption>
<thead>
<tr>
<td></td>
<th>Firefox</th>
<th>Chrome/Edge</th>
<th>Safari</th>
</tr>
</thead>
<tbody>
<tr>
<th>TalkBack</th>
<td> In both the control and test case example, the summary and details elements expose no roles.</td>
<td>"disclosure triange" role and correctly announces state. article or region role is not exposed, regardless if named or not.</td>
<td>n/a</td>
</tr>
<tr>
<th>VoiceOver</th>
<td>
macOS: <strong>no role or state announcement for summary.</strong>
</td>
<td>
macOS: "disclosure triange" role. correctly announces state.
</td>
<td>iOS: <strong>no role or state announcement.</strong><hr>
macOS: "summary" role. correctly announces state.
</td>
</tr>
<tr>
<th>Narrator (win10)</th>
<td><strong>no role or state announcement.</strong></td>
<td>announces "button" and expanded / collapsed state.
"article" role is only announced if it is given a name.</td>
<td>n/a</td>
</tr>
<tr>
<th>NVDA</th>
<td>no role announced. Expanded / collapsed state announced.</td>
<td>buttton role announced. Expanded / collapsed state announced on first focus. This lack of consistent announcement also occurs when no role has been specified on details element.</td>
<td>n/a</td>
</tr>
<tr>
<th>JAWS</th>
<td>Changing the role of the details element results in the announcement of that role when navigated to with Tab key, and no role/state announcement of the summary element. If toggled while it has keyboard focus, an expanded/collapsed state can still announce. But without the 'button' role, the fact that oen could expand the element would not be conveyed. Furhter issues were found when testing other one-off roles, e.g., group without a name.</td>
<td>announces "button" and its expanded / collapsed state on initial focus. "article" may be heard if navigating by virtual cursor down arrow, but navigating to the "summary" with tab key only announces the button role, name, and its current state. if the article is named, it will be announced as an "article region" when focusing the summary with the Tab key.</td>
<td>n/a</td>
</tr>
</tbody>
</table>
</div>
-->
body {
font-family: arial;
margin: 1.25em;
background: #fafafa;
padding: .55em;
}
header {
margin: 0 0 .75em;
padding-bottom: .75em;
border-bottom: 1px solid #aaa;
h1 {
margin: 0;
}
:last-child {
margin-bottom: 0;
}
}
summary h3 {
display: inline-block;
margin: 0;
}
h2 {
margin-top: 1.5em;
margin-bottom: .75em;
}
.tests {
max-width: 400px;
}
caption { text-align: left; font-size: 1.25em; margin-top: 1em;}
.results {
table {
width: 100%;
min-width: 1100px;
}
th {
word-break: break-word;
font-size: .82em;
}
th, td:not(:empty) {
border: 1px solid;
text-align: left;
padding: .25em;
min-width: 140px;
}
}
.result-tables {
overflow: auto;
}
li p {
margin: .5em 0;
}
.concern {
background: lightyellow;
font-weight: bold;
}
details {
margin: 1em 0;
}
/*
JAWS 2022.2110.60
NVDA 2021.3.3
*/
Also see: Tab Triggers