aria widgets
DESCRIPTION
ARIA is a W3C specification that can be used to dramatically improve the accessibility of custom widgets, especially for users of screen readers. This talk provides practical tips and design patterns for using ARIA to create accessible user interfaces that work across all of the various combinations of browsers and screen readers that support ARIA. Additionally, this talk will focus on the tools and methodologies developers need to test ARIA in order to ensure the best possible user experience.TRANSCRIPT
- 1.ARIArvoe rcq grwidgets Todd Kloots @todd
2. http://yaccessibilityblog.com/library/understanding-aria-widgets.htmlThis presentation has a corresponding blog post on the Yahoo! Accessibility blog. 3. Screen ReadersRead the code (HTML)Read the focused elementWhat is read:Element/Control typeLabelPropertiesState changes 4. Demo http://youtu.be/ZnlvBIfTQfIDemo of interacting with a checkbox using VoiceOverthe screen reader for the Mac. Notice how VoiceOver announces the control type (checkbox), the label (Send me offers), and thecurrent state (checked and not checked).All this text is announced to ensure that users of screen readers can perceive and operate the widget. 5. Demo http://youtu.be/ZnlvBIfTQfIDemo of interacting with a checkbox using VoiceOverthe screen reader for the Mac. Notice how VoiceOver announces the control type (checkbox), the label (Send me offers), and thecurrent state (checked and not checked).All this text is announced to ensure that users of screen readers can perceive and operate the widget. 6. Widgets BreakThats the experience for existing widgets. But often custom widgets dont work this well with screen readers. 7. See HearFor custom controls, most often problems are caused when there is a gap between the visual and audio user experience such that users of screen readers do not have access to the sameinformation as sighted users. 8. Primary Cause 9. The code doesnt accuratelyexpress what you mean. 10. You ForgotOften this is because either you forgot to use the right, most semantic markup for the job. 11. You Are Limited
Or, reason #2: You are limited by the expressiveness of HTML. For example, ideally youd declare a dialog using a tag, but for lack of one you use a
- EmailInstant MessageSMS
- And well have attributes for state. For example, well be able
to declare menu has hidden using the hidden attribute. 26. EmailAnd
a menuitem as selected using the selected attribute. 27. YOU ARE
HEREBut currently, depending on the browser and device you are
supporting, you nd yourself in the middle: robust support for HTML
4.01 with emerging support for HTML 5 controls. 28. Go
Native?Native widget works as expected?Native widget is
accessible?Browser and platform constraints?Native supports
required style andbehavior customizations?And so every developer is
faced with the decision of whether or not to use a native HTML 5
control. There are many factors to consider. 29.
- EmailInstant MessageSMS
- EmailN
- Instant MessageI
- SMST
- EmailInstant MessageSMS
- EmailN
- Instant MessageI
- SMST
- // Native DOM node.setAttribute("role", "menu"); // jQuery node.attr("role" "menu"); // YUI node.set("role" "menu");The role attribute can be declared in markup, or set programmatically using JavaScript. 42. Denitive Number of Roles
- 50. Setting ARIA Properties Properties allow you to communicate
aspects of a control, for example: that a menu item has a popup
menu.ARIA properties are always prexed with "aria-". 51. Setting
ARIA Properties node.setAttribute("aria-haspopup", true);Properties
allow you to communicate aspects of a control, for example: that a
menu item has a popup menu.ARIA properties are always prexed with
"aria-". 52. Some Examples aria-haspopup aria-readonly
aria-controls aria-label aria-labelledby aria-describedby 53.
Setting ARIA StatesARIA states are used to communicate widget state
information you are likely already maintaining in a widget class
and rendering back to the view via markup and CSS. 54. Setting ARIA
Statesnode.setAttribute("aria-disabled", true);ARIA states are used
to communicate widget state information you are likely already
maintaining in a widget class and rendering back to the view via
markup and CSS. 55. Some Examples aria-hidden aria-disabled
aria-expanded aria-invalid 56. Native vs. ARIA
-
- When compared alongside native semantics, ARIA attributes look
and feel less alien. For example, I like to think of ARIA roles as
tags in attribute form. And ARIA attributes are just likenative
attributes, just with an aria- prex. 57. Using roles, states, and
properties Set via JavaScript using setAttribute() Remember
properties and states require "aria-"
prexnode.setAttribute("aria-hidden",
false);node.setAttribute("aria-haspopup", true); Denitive number of
roles, states and properties ARIA trumps existing semantics 58.
Implementation Tips 59. Dening Controls 60. In the interest of
Progressive Enhancement, when building custom widgets always start
with the closest native semantics and supplement with ARIA 61. Dene
Semantics Start with closest structural HTML Add ARIA 62. Styling
State 63. Styling Roles, States and Properties a:focus { } a:active
{ } a:hover { } button[disabled] { background: ...; }For native
HTML form controls, CSS enables the styling of states using pseudo
classes and attributes selectors. 64. Styling Roles, States and
Properties .menu.hidden { } .menuitem.selected { }
.menuitem.disabled { }For custom widgets, developers have typically
used class names. 65. Styling Roles, States and
Propertiesul[role=menu] {}button[aria-haspopup] {background:
...;}li[aria-disabled=true] {color: #ccc;}ul[aria-hidden=true]
{display: none;}Since ARIA uses attributes, ideally we could simply
leverage attribute selectors for styling ARIA widget types, and
states. 66. Styling Roles, States and Properties ul[role=menu] { }
button[aria-haspopup] { background: ...; } li[aria-disabled] {
color: #ccc; } ul[aria-hidden] { display: none; }For ARIA
attributes that accept a boolean, we can make the CSS even more
terse by just testing the presence of the attribute. 67. Styling
Roles, States and Properties li[aria-disabled] { color: #ccc; }
ul[aria-hidden] { display: none; } // Set disabled
node.setAttribute(aria-disabled, true); // Unset disabled
node.removeAttribute(aria-disabled);Wed set the attributes using
setAttribute(), and unset them using removeAttribute(). 68.
However, if you need to support older IEs (6 & 7) this wont
work. IE 6 doesnt provide support for attribute selectors.
Additionally, IE 7 supports attribute selectors, but when
attributes are setusing setAttribute() they dont trigger the change
in style expressed in CSS. 69. Styling Roles, States and Properties
// Semantically express state node.setAttribute(aria-disabled,
true); // Style state node.addClass(disabled);So, if you need to
support older versions of IE you need to touch the DOM twice for
every state update: once to set the ARIA role (to ensure the state
change is communicated to users ofscreen readers), another time to
set the class for visual style. 70. LabelsARIA provides some
additional means of labeling widgets beyond the tag. 71. For
example, all widgets need to be labeled, but sometimes the visual
design doesnt call for the label. 72. Label Composite Widgets
System Folders
- Inbox
- Drafts
- Folder 1
- Folder 2
- Inbox
- Drafts
- Folder 1
- Folder 2
Confirm CloseYour message has not been sent. Do you want to save it in your Drafts folder?
Save to Drafts Dont Save Keep WritingPress Ctrl + [, or Ctrl + ] to switch tabs.- Another use case for aria-describedby would be if you want to provide additional instructional/tutor text for users of screen readers. For example, to alert users of the keyboard shortcutsavailable for operating a widget. 78. The aria-describedby Propertyvar description = document.createElement("div");description.id = "description";// Hide off screen via CSSdescription.className = "hidden";document.body.appendChild(description);tabView.setAttribute("aria-describedby", "description");Since the aria-describedby attribute takes an id, you often need to hide the element containing description off screen using CSS. 79. .element-invisible {position: absolute !important;height: 1px; width: 1px;overflow: hidden;clip: rect(1px 1px 1px 1px); /* IE6, IE7 */clip: rect(1px, 1px, 1px, 1px);} http://snook.ca/archives/html_and_css/hiding-content-for-accessibilityMy current, preferred method of hiding content that still needs to be accessible to users of screen readers. 80. Repair Nesting 81. Repairing Nesting
1 new Tweetadditions* removals text* all(additions removals text)*default valuesDevelopers can control what type of information is announced using the aria-relevant attribute. 96. Roles that are live regions by defaultalertstatustimermarqueelogSome ARIA roles are live regions by default, and dont require the use of the aria-live attribute. 97.hey - let me knowwhen you are available.id like to discuss a fixwith you
hey - let me know when you are available. id like to discuss a fix with you
thanks
hey - let me knowwhen you are available.id like to discuss a fixwith you
thanks
yt?
- When compared alongside native semantics, ARIA attributes look
and feel less alien. For example, I like to think of ARIA roles as
tags in attribute form. And ARIA attributes are just likenative
attributes, just with an aria- prex. 57. Using roles, states, and
properties Set via JavaScript using setAttribute() Remember
properties and states require "aria-"
prexnode.setAttribute("aria-hidden",
false);node.setAttribute("aria-haspopup", true); Denitive number of
roles, states and properties ARIA trumps existing semantics 58.
Implementation Tips 59. Dening Controls 60. In the interest of
Progressive Enhancement, when building custom widgets always start
with the closest native semantics and supplement with ARIA 61. Dene
Semantics Start with closest structural HTML Add ARIA 62. Styling
State 63. Styling Roles, States and Properties a:focus { } a:active
{ } a:hover { } button[disabled] { background: ...; }For native
HTML form controls, CSS enables the styling of states using pseudo
classes and attributes selectors. 64. Styling Roles, States and
Properties .menu.hidden { } .menuitem.selected { }
.menuitem.disabled { }For custom widgets, developers have typically
used class names. 65. Styling Roles, States and
Propertiesul[role=menu] {}button[aria-haspopup] {background:
...;}li[aria-disabled=true] {color: #ccc;}ul[aria-hidden=true]
{display: none;}Since ARIA uses attributes, ideally we could simply
leverage attribute selectors for styling ARIA widget types, and
states. 66. Styling Roles, States and Properties ul[role=menu] { }
button[aria-haspopup] { background: ...; } li[aria-disabled] {
color: #ccc; } ul[aria-hidden] { display: none; }For ARIA
attributes that accept a boolean, we can make the CSS even more
terse by just testing the presence of the attribute. 67. Styling
Roles, States and Properties li[aria-disabled] { color: #ccc; }
ul[aria-hidden] { display: none; } // Set disabled
node.setAttribute(aria-disabled, true); // Unset disabled
node.removeAttribute(aria-disabled);Wed set the attributes using
setAttribute(), and unset them using removeAttribute(). 68.
However, if you need to support older IEs (6 & 7) this wont
work. IE 6 doesnt provide support for attribute selectors.
Additionally, IE 7 supports attribute selectors, but when
attributes are setusing setAttribute() they dont trigger the change
in style expressed in CSS. 69. Styling Roles, States and Properties
// Semantically express state node.setAttribute(aria-disabled,
true); // Style state node.addClass(disabled);So, if you need to
support older versions of IE you need to touch the DOM twice for
every state update: once to set the ARIA role (to ensure the state
change is communicated to users ofscreen readers), another time to
set the class for visual style. 70. LabelsARIA provides some
additional means of labeling widgets beyond the tag. 71. For
example, all widgets need to be labeled, but sometimes the visual
design doesnt call for the label. 72. Label Composite Widgets
System Folders
-