A Pen by Brian Kardell on CodePen.
Created
September 18, 2015 22:19
-
-
Save bkardell/288ecf935c3754f7480d to your computer and use it in GitHub Desktop.
vNGPwP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<section> | |
<h1>What's this?</h1> | |
<p>"Actionable" elements (ie, elements like <code><a>,<button>,<input type="button"></code>) have no ideal patterns around how you manage tooltips in a way that it simultaneously accessible and touch friendly. It's easy enough to add <code>aria-describedby</code> and some CSS involving <code>:hover, :focus</code> to most elements, but these elements are different: clicking them doesn't just set focus, it activates some behavior. This means that there is no way for users of touch-based devices to get the same sort of information. You can add a help button but this easily leaves blind users in the lurch because the button itself isn't described and they likely have no idea that the _next_ element contains help for this one. In a word, this situation kind of sucks. A user might needs to know what that button does before they want to click it, but we cannot dedicated a major portion of the UI to always showing a descrition of it. Figuring out an approach that works everywhere is kind of hard, so what we've done here is extracted a simple pattern and wrapped a custom element around it...</p> | |
<contextual-actionable data-placement="bottom"> | |
<button>Test EBR</button> | |
<contextual-message>Lauches a national EBR test "This is a test of the Emergency Broadcast System..." | |
</contextual-message> | |
</contextual-actionable> | |
<hr> | |
<h2>Source...</h2> | |
<code class="source"><pre><!-- polyfill of custom elements API and our contextual elements --> | |
<script src="https://rawgit.com/bkardell/common-panel/gh-pages/prototype/custom-elements.js"></script> | |
<script src="https://rawgit.com/bkardell/contextual-elements/master/contextual.js"></script> | |
<!-- wrap around an actionable element and provide the message - it's progressively enhanced > | |
<contextual-actionable> | |
<button>Test EBR</button> | |
<contextual-message>Lauches a national EBR test "This is a test of the Emergency Broadcast System..."</contextual-message> | |
</contextual-actionable> | |
</pre></code> | |
</section> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://rawgit.com/bkardell/common-panel/gh-pages/prototype/custom-elements.js"></script> | |
<script src="https://rawgit.com/bkardell/contextual-elements/master/contextual.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
code { | |
color: maroon; | |
font-weight: bold; | |
} | |
code.source { | |
display: block; | |
padding-left: 1em; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment