Child pages
  • Tutorial - Keyboard Accessibility Plugin

Documentation for a historical release of Infusion: 1.3
Please view the Infusion Documentation site for the latest documentation.
If you're looking for Fluid Project coordination, design, communication, etc, try the Fluid Project Wiki.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

This tutorial is incomplete. Any information here should be considered to be incorrect until this warning is remove.

This documentation refers to the trunk version of the keyboard accessibility plugin. For documentation specific to the v0.3 release, please see Keyboard Accessibility Tutorial - v0.3.

The Fluid library includes a jQuery Keyboard Accessibility plugin. This plugin allows developers to add keyboard handlers to their code without a lot of extra overhead. This tutorial will walk the reader through an example of using the plugin.

This tutorial assumes that:

  • you are already familiar with HTML, Javascript and CSS
  • you are basically familiar with what the Keyboard Accessibility Plugin is and does
  • now you just want to know how to use it.

For technical API documentation, see Keyboard Accessibility Plugin API.

Tutorial: How to Use the Keyboard Accessibility Plugin

Scenario

Let's say you are creating a set of tabs using an unordered list. This tutorial will show you how to use the jQuery Keyboard Accessibility Plugin to ensure that your tabs can be used with the keyboard.

There are four basic steps to adding the <Component> to your application:

  • Step 0: Download and install the Fluid Infusion library
  • Step 1: Prepare your markup
  • Step 2: Write the script
  • Step 3: Add the script to your HTML
  • Step 4: Apply styles

The rest of this tutorial will explain each of these steps in detail.

On This Page
Still need help?

Join the fluid-talk mailing list and ask your questions there.


Step 0: Download and install the Fluid Infusion library

  1. Download a copy of the Fluid Infusion component library from:
  2. Unpack the zip file you just downloaded, and place the resulting folder somewhere convenient for your development purposes.
    The folder will have the release number in it's name (e.g. fluid-0.4/). The rest of this tutorial will use fluid-0.4 in its examples, but if you downloaded a different version, you'll have to adjust.

Step 1: Prepare your markup

Let's say you are creating a set of tabs using an unordered list, like so:

<ul id="tabs">
  <li><a href="#catsPanel">Cats</a></li>
  <li><a href="#dogsPanel">Dogs</a></li>
  <li><a href="#hamstersPanel">Hamsters</a></li>
  <li><a href="#alligatorsPanel">Alligators</a></li>
</ul>

and you are using <div> s for the panels, like so:

<div id="panels">
  <div id="catsPanel">
    Cats <a href="http://icanhascheezburger.com/2007/01/11/i-can-has-cheezburger/">meow</a>.
  </div>
  <div id="dogsPanel">
    Dogs <a href="http://thebark.com/">bark</a>.
  </div>
  <div id="hamstersPanel">
    Hamsters <a href="http://en.wikipedia.org/wiki/Hamster_wheel">wheel</a>.
  </div>
  <div id="alligatorsPanel">
    Alligators <a href="http://www.drinknation.com/drink/Alligator-Bite">bite</a>.
  </div>
</div>

Assuming you have styles that will display the list items horizontally, for example the following:

 

then in a browser window, this might look something like this:

<screenshot of page here>

The <Component> needs to know about the 'container' of .... In this case, <...> would be the container... We'll attach unique IDs each of these so that we'll be able to identify them to the <Component>:

modified html here

That's all - these are the only changes you need to make to your HTML.


Step 2: Write the script

You'll need to create a file, say filename, to contain your initialization script - the script you write to apply the <Component> to your <stuff>.

In this file, write a function that <...>:

jQuery(document).ready(function () {
    initialization code here
});

<explain the function>

Important note

<any caveats about selectors, and the fact that any selector will do, not just the one in the example.>


Step 3: Add the script to your HTML

You'll need to add your initialization script, along with the Fluid library, to you HTML file. In the header of the file, link to the Javascript files with <script> tags:

<script type="text/javascript" src="fluid-0.4/fluid-components/js/Fluid-all.js"></script>
<script type="text/javascript" src="<filename>.js"></script>

NOTE that the Fluid-all.js file is minified - all of the whitespace has been removed, so it isn't really human-readable. If you're using the source distribution and you want to be able to debug the code, you'll want to include each of the required files individually. This would look like this:

<script type="text/javascript" src="fluid-0.4/fluid-components/js/jquery/jquery-1.3.1.js"></script>
<script type="text/javascript" src="fluid-0.4/fluid-components/js/jquery/jquery.keyboard-a11y.js"></script>
...other files, if necessary...
<script type="text/javascript" src="fluid-0.4/fluid-components/js/jquery/jARIA.js"></script>
<script type="text/javascript" src="fluid-0.4/fluid-components/js/fluid/Fluid.js"></script>
<script type="text/javascript" src="fluid-0.4/fluid-components/js/fluid/<Component>.js"></script>
<script type="text/javascript" src="<filename>.js"></script>

But all of these individual files are not necessary to make it work - the Fluid-all.js file has everything you need.

That's it! That's all you need to do to add the <...> functionality to your document.

BUT: If you look at the file in a browser now, it doesn't look any different than it looked before - there's no way to tell that <...>. That's what the styles are for.


Step 4: Apply styles

There are a number of "interesting moments" that happen while <...>. These include, for example, <...>

Important note

The styles in the example below are just that: examples. You are free to create whatever styles you like <...>. The important thing to understand is

  • what the interesting moments are, and
  • what the names of the styles for those moments are

This is a panel that can be used for tips, notes, etc.

  • No labels