Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <header>
	<h1>Styled summary test case</h1>
	<p>Published: March 3, 2022</p>
<!-- 	<p>Last updated: June 17, 2022</p> -->
	<p>Last updated: August 9, 2022</p>
</header>

<details>
	<summary>Unstyled control</summary>
	For comparative purposes.
</details>

<details class=styled>
	<summary>A styled summary test</summary>
	<div>
		<p>The default marker was removed and a new ::after pseudo-element was used to create the downward facing arrow.</p>
		<p>See also <a href="https://codepen.io/scottohara/pen/aaJXYG">more information on summary announcements</a>
	</div>
</details>

<div class=results>
	<div class=result-tables>
		<table>
			<caption>Default summary (control) disclosure triangle marker</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>Triangle Marker Announced?</th>
				<!-- narrator -->
				<td>No</td>

				<!-- mosvo -->
				<td>No</td>
				<td class=concern>Only when toggling: "black [down/right] pointing small triangle" where direction is based on current state of widget.<p>this is the only way in which state is communicated, due to the change in accName (marker direction) of the summary.</p></td>
				<td>No</td>

				<td>No</td>

				<!-- nvda -->
				<td>No</td>
				<td class=concern>"Filled [down/right] pointing small triangle" where direction is based on current state of widget. State is also communicated as "expanded/collapsed".</td>

				<!-- jaws -->
				<td>No</td>
				<td class=concern>"Black [down/right] pointing small triangle" where direction is based on current state of widget. Direction change is NOT ANNOUNCED when state is changed. State is communicated separeately on toggle.</td>

				<!-- tb -->
				<td>No</td>
				<td class=concern>No, but triangle can be unexpectedly focused by TalkBack, and swiping can even become temporarily stuck if toggling while focused on the triangle.</td>
			</tr>

		</table>

		<table>
			<caption>Styled summary 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 role announced?</th>
				<!-- narrator -->
				<td>"Disclosure triangle"</td>

				<!-- mosvo -->
				<td>"Disclosure triangle, group"</td>
				<td>"Summary, group"</td>
				<td>"Summary, group"</td>

				<td class=concern>No <small>(same as unstyled)</small></td>

				<!-- nvda -->
				<td>"Button"</td>
				<td>"Button"</td>

				<!-- jaws -->
				<td>"Button"</td>
				<td>"Button"</td>

				<!-- tb -->
				<td>"Disclosure triangle"</td>
				<td class=concern>Intermittent "button" announcement <small>(same as unstyled)</small></td>
			</tr>

			<tr>
				<th>Expand/Collapse state exposed?</th>
				<!-- narrator -->
				<td class=concern>Initial focus will announce state.<br>
					Expanded state will announce.
					<br>Toggling to collapsed will not.</td>

				<!-- mosvo -->
				<td class=concern>Initial focus will announce state.<br>
					Expanded state will announce.
					<br>Toggling to collapsed will not.
				</td>
				<td class=concern>Initial focus will announce state.<br>No announcement when toggling state.</td>
				<td>Yes</td>

				<td class=concern>No <small>(same as unstyled)</small></td>

				<!-- nvda -->
				<td class=concern>Announces state on focus.  Announces state change on first expansion of disclosure widget. Subsequent toggling of state not announced.</td>
				<td>Yes</td>

				<!-- jaws -->
				<td class=concern>Announces state on focus.  Announces state change on first expansion of disclosure widget. Subsequent toggling of state not announced.</td>
				<td>Yes</td>
				
				<!-- tb -->
				<td>Yes</td>
				<td>Yes</td>
			</tr>

		</table>
	</div>
</div>
              
            
!

CSS

              
                
.styled summary::-webkit-details-marker {
 display: none;
}

.styled summary {
 list-style: none;
	padding: 1em;
	cursor: default;
	border: 1px solid;
	background: #fafafa;
	padding-right: 1.5em;
	position: relative;
	
	&::after {
		content: '';
		border-right: 4px solid;
		border-bottom: 4px solid;
		position: absolute;
		right: .75em;
		height: .75em;
		width: .75em;
		transform: rotate(45deg) translatey(-.1em);
	}
	
	&:focus {
		outline: 2px solid;
		outline-offset: 1px;
	}
}

details[open].styled > summary::after {
	transform: rotate(-135deg) translatey(-.3em);
}

details > div {
	padding: 1em;
	border: 1px solid;
	border-top: 0;
}

details {
	margin: 1em 0;
}




// results and non-disclosure widget styles
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 {
  border-top: 1px solid;
		margin-top: 2em; 
	
  table {
    width: 100%;
    min-width: 1100px;    
  }
	caption {
		margin: 1em 0;
	}
  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;
}

              
            
!

JS

              
                
              
            
!
999px

Console