Skip to content

Commit

Permalink
Using parallel language to remove ambiguity (#12356)
Browse files Browse the repository at this point in the history
  • Loading branch information
ycombinator authored Jun 19, 2017
1 parent 77e91c7 commit 65c4bb2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ui_framework/components/accessibility/keyboard_accessible.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
* <input type="button">, or <button>). Note that links should be used when navigating and buttons
* should be used when performing an action on the page.
*
* If you need to use a <div>, <p>, or <a> without the href attribute, then you need to allow
* them to receive focus and to respond to keyboard input. The workaround is to:
* If, however, you need to use elements that aren't natively keyboard accessible (for example, <div>,
* <p>, or <a> without the href attribute), then you need to allow them to receive focus and to
* respond to keyboard input. The workaround is to:
*
* - Give the element tabindex="0" so that it can receive keyboard focus.
* - Add a JavaScript onkeyup event handler that triggers element functionality if the Enter key
Expand All @@ -15,7 +16,8 @@
* - If the item is meant to function as a button, the onkeyup event handler should also detect the
* Spacebar in addition to the Enter key, and the element should be given role="button".
*
* Wrap any of these elements in this component to automatically do the above.
* Wrap any such elements that aren't natively keyboard accessible in this component to automatically
* apply the above workaround to them.
*/

import {
Expand Down

0 comments on commit 65c4bb2

Please sign in to comment.