Accessibility Note

This presentation uses an out-of-the box HTML slideshow script which by itself is inaccessible. Keybindings exist to traverse forward and backward with arrow keys, but focus never shifts as the slides advance. The slides themselves are well structured, so you can use a read all command to listen to everything linearly. I've also added a live region which should work well for screen readers that support live regions. As you traverse through the slides using arrow keys, the slide's content will be added to the live region. If all else fails, you can also access the slideshow content by turning off CSS and JavaScript.

Web Components: An Introduction

What they are, how they work, and their challenges

Alice Boxhall, Google

Karl Groves, The Paciello Group

Re-imagining the web

HTML today

Root element1
Document metadata6
Scripting2
Sections101
Grouping14
Text-level semantics26
Edits2
Embedded content12
Tables10
Forms14 + 232
"Interactive elements"4
Total124

1. Counting all headings as one type
2. 23 types of <input>

HTML today

date input on iOS date input on Android

HTML today

tabs on google.com
tabs on twitter.com
tabs on github.com

HTML today

It's <div>s all the way down!

screenshot of Google Docs DOM

HTML evolves

Chromium dashboard showing intent to implement getComputedName and getComputedValue

HTML evolves... slowly

Meanwhile...

Semantics

screenshot of GitHub Code tab
<a
 
href="..."
 
class="selected sunken-menu-item">

    <span class="octicon octicon-code"></span>
    <span class="full-word">Code</span>
</a>
<gh-tab selected="true" icon="code">Code</gh-tab>

Introducing Web Components

Reusable Encapsulated
Composeable Extensible
<link rel="import" href="gmail-widgets.html">
...
<gmail-app>
    <gmail-folderlist>...</gmail-folderlist>
    <gmail-toolbar>
        <gmail-buttongroup>
            <button is="gmail-button" icon="return" action="back" tip="Back to search results"></button>
        <gmail-buttongroup>

Web Components components

<template>

      <template id="hello"><p>Hello, world!</p></template>
      <script>
          for(var i = 0; i < 3; i++) {
              document.appendElement(
                  $("#hello").content.cloneNode(true));
          }
      </script>
    
      <p>Hello, world!</p>
      <p>Hello, world!</p>
      <p>Hello, world!</p>
    

Custom elements

Pearl the unicorn bike

Lifecycle callbacks

CallbackCalled when...
createdCallback()this element instance is created
attachedCallback()this element is inserted into the document>
attributeChangedCallback(
attrName, oldVal, newVal)
an attribute was added, removed, or updated
detachedCallback()this element is removed from the document
      function GmailButton() {}
      GmailButton.prototype = {
        __proto__: HTMLButtonElement.prototype,
        createdCallback: function() {
          var templateContent = $('template').content;
          this.appendChild(templateContent.cloneNode(true)};
        },
        attributeChangedCallback: function(att, was, is) {},
        extends: 'button'
      }
      document.registerElement('gmail-button', GmailButton);
    
      <gmail-button></gmail-button>
    

HTML imports

<link rel="import" href="gmail-widgets.html">

Shadow DOM

Screenshot showing inspecting Shadow DOM in devtools

Explaining the web

Work in progress...

Support

Nelson, a character from the Simpsons, pointing and laughing.

Support

Browser Support as of September 2014
Specification Chrome Opera Firefox Safari IE
Templates Yes Yes Yes No No
HTML Imports Yes Yes Sort of No No
Custom Elements Yes Yes Sort of No No
Shadow DOM Yes Yes Sort of No No

Good News

You can totally make these things accessible. This changes nothing from the accessibility perspective.

Bad News

Web Components are the new jQuery plugins

How to do it right

Picture I borrowed from Steve Faulkner. It says:
Something Karl Groves said: I'm writing a new talk titled "Demystifying Web Components Accessibility". It has one slide. It says "Same as regular ole web accessibility. Seriously. Stop overthinking it"

First: follow all your standard accessibility best practices

Don't reinvent the wheel

Solve Real Problems

Longdesc web component

Consider the User

Example web component

No, really. Consider the User

Flipbox example component

Be Creative

Example of image-caption

WAI-ARIA

CSV-to-HTML table, fixed by Karl to be accessible

Some Cautions

The road ahead

Things are changing

The final shape is yet to be decided

We have work to do!

winding road

Contact Us

Alice Boxhall

Email
aboxhall@chromium.org
Work
Google Accessibility, Chromium
Twitter
@sundress

Contact Us

Karl Groves

Phone
+1 410.541.6829
Email
karl@karlgroves.com
Work
The Paciello Group
Twitter
@karlgroves
Blog
karlgroves.com
LinkedIn
http://www.linkedin.com/in/karlgroves

Resources

Moar Resources

So many Resources

Bonus Material

Bonus Material

Bonus Material

Bonus Material