From 20cf042d143a6701dae0680c9a25bd528af0f521 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Mon, 8 May 2017 10:26:51 -0700 Subject: [PATCH 1/2] Add title and tooltip accessibility information to HTML style guide. --- style_guides/html_style_guide.md | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/style_guides/html_style_guide.md b/style_guides/html_style_guide.md index 7297619ae36c15..2091d3dcd669c0 100644 --- a/style_guides/html_style_guide.md +++ b/style_guides/html_style_guide.md @@ -27,4 +27,39 @@ If the element doesn't have children, add the closing tag on the same line as th attribute2="value2" attribute3="value3" > +``` + +## Accessibility + +### Don't use the `title` attribute + +The `title` has no clear role within the accessibility standards. +[See the HTML5 spec](http://w3c.github.io/html/dom.html#the-title-attribute) for more information. + +To provide supplementary, descriptive information about a form control, button, link, or other element, use +a tooltip component instead. + +Additional reading: + +* https://www.paciellogroup.com/blog/2010/11/using-the-html-title-attribute/ +* https://www.paciellogroup.com/blog/2012/01/html5-accessibility-chops-title-attribute-use-and-abuse/ +* https://www.deque.com/blog/text-links-practices-screen-readers/ + +### Tooltips + +Elements which act as tooltips should have the `role="tooltip"` attribute and an ID to which the +described element can point to with the `aria-describedby` attribute. For example: + +```html + + + ``` \ No newline at end of file From d2a25a2969b60622e4afcfc5ce446616cbde545f Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Thu, 8 Jun 2017 14:38:54 -0700 Subject: [PATCH 2/2] Add sections on native interactive elements and tab order. --- style_guides/html_style_guide.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/style_guides/html_style_guide.md b/style_guides/html_style_guide.md index 2091d3dcd669c0..b7b9124e131c45 100644 --- a/style_guides/html_style_guide.md +++ b/style_guides/html_style_guide.md @@ -9,7 +9,7 @@ This makes the attributes easier to scan and compare across similar elements. The closing bracket should be on its own line. This allows attributes to be shuffled and edited without having to move the bracket around. It also makes it easier to scan vertically and match opening and closing brackets. This format is inspired by the positioning of the opening and closing parentheses in [Pug/Jade](https://pugjs.org/language/attributes.html#multiline-attributes). -``` +```html
Visualizations -``` \ No newline at end of file +``` + +### Prefer `button` and `a` when making interactive elements keyboard-accessible + +If something is meant to be clickable, favor using a `button` or `a` tag before over the `kui-accessible-click` directive or `KuiKeyboardAccessible` component. These tools are useful as they augment non-clickable elements with `onkeypress` and `onkeyup` handlers, allowing non-clickable elements to become keyboard accessible. However, `button` and `a` tags provide this functionality natively. + +### Use `tabindex` to make elements tabbable + +When added to the tab order, elements become focusable via non-sticky-mode keyboard navigation. +To add an element to the tab order, you must add an `id` attribute as well as a `tabindex` attribute. If you don't know which number to use for the tab index, or if you simply want to add it to the general flow of the document, use `tabindex="0"`. \ No newline at end of file