« Flash Test Suite - Exposing Buttons | Main | Getting Designers to do Flash accessibility »

August 05, 2004

Simple Text Navigation

One of the most basic uses of Flash is to create a simple text navigation bars. Numerous examples exist on the web, either as a part of a larger Flash movie or as part of a hybrid Flash/html site. I built a small example you can view at:

http://www.markme.com/accessibility/files/max04/flash/wi_text.html

The source files are at:

http://www.markme.com/accessibility/files/max04/flash/wi_text.fla

When you are evaluating a simple text navigation bar, there just a couple of things you want to check. First, you want to be sure you can tab to every button in the navigation bar. In most cases, the player will handle this on its own. I have not found many examples where this is not the case.

Second, you need to check with a screen reader. Here, you want to be sure to use the down arrow as you read through the buttons on the page. This is how screen reader users will read through the contents of the movie. As you reach each button, you want to be sure the text label is read AND the word ‘button’. You want to be sure that it does not take one press of the down arrow key to hear the label and another to read the word ‘button’.

Here are a couple of examples where the labels are not read properly.

Nike Running
http://www.nike.com/nikerunning/index.jhtml

Notice that the top level buttons read labels but don’t identify as buttons.

Nikon UK
http://www.nikon.co.uk/

Notice that the buttons on the right read labels but don’t identify as buttons.

To build a simple button, start by placing the text inside of the button or movie clip. It really doesn’t matter if you use a button or a movie clip. The player will assign this text object as the label for the button. You won’t need to do anything extra. Avoid using more than text object in the button. The player will pick just one as the label.

Next, assign the script to the button. The only caution here is to avoid nesting the onRelease event inside of the button itself. This is the most likely the reason the examples shown above are not reading correctly. These scripts are likely constructed to allow the rollover effects to make changes to the child objects within the button. This is fine. However, the screen readers do not detect events if they are nested inside of the button.

Posted by Bob Regan at August 5, 2004 01:17 AM

Comments

In all fairness to designers, if you have a funky fresh over state for your button, let it shine! Get ride of the yellow focus rect, that yellow box that showcases where your tabbed selection is.

_focusrect = false;

The property is global, and that's all you have to do.

Nice point to bring up, Mr. Regan!

Posted by: JesterXL at August 5, 2004 07:43 AM

Hi Jester,

NOOOO!!!!! Do not do this! Sadly, there is a known bug in the player where disabling the focus rectangle disables keyboard access altogether. So this is a very bad idea.

For now, funky fresh rollovers are welcome in all other forms.

Posted by: Bob Regan at August 5, 2004 11:11 AM

Actually, one can work around the _focusrect bug, by explicitly defining an onSetFocus event to the button that assigns a key listener checking for an ENTER or SPACE key-press. Use an onKillFocus event to remove the listener.

Generally, I think users who use keyboard focus to navigate Flash document are accustomed to seeing the yellow rectangles, so for those users, turning them off may do more harm than good from a usability standpoint. But in some cases, it can make sense. For example, check out this scrolling navigation menu: http://www.eduplace.com/kids/hmr05/?grade=1. In this situation, I actually disable the _focusrect for menu items in the scrolling pane and recreate the yellow rectangle with ActionScript so that when the content scrolls, the rectangle moves with the focused item. The actionable menu items have their own selection highlight style, so I use the onSetFocus/onKillFocus technique to capture keyboard activation of the buttons.

Posted by: Michael Jordan at August 6, 2004 10:21 AM

Very cool. This is an impressive piece (as always).

Posted by: Bob Regan at August 6, 2004 10:47 AM

I think the same onSetFocus/onKillFocus method is used by Macromedia UI Components to draw the inner and outer focus rectangles around the UI elements. Usually when I use the components, I set the style of the inner and outer focus rectangles to yellow, so that they are consistent with any other keyboard-enabled elements. In fact, I do that in the example I mentioned above.

Posted by: Michael Jordan at August 6, 2004 01:58 PM

Hi Bob

Is there any way of globally changing the yellow highlight box to some other colour or graphic?

Yellow is a pretty good colour to achieve high contrast on most projects but there's one that i'm working on where we change the colour of all the screen elements to accomodate various visual impairments and we actually need low contrast.

I notice that when you tab around the buttons on the top navigation movie at macromedia.com you get green boxes that fade into the background and a highlight if you rollover them. That's the kind of effect I'm after!

Thanks

Simon

Posted by: Simon at August 9, 2004 11:05 AM

There is no way to change the default _focusrect color. The green, halo-themed effect is acheived in the UI components by drawing the focus rectangle with ActionScript triggered by an onSetFocus event.

The effect used in the navbar on macromedia.com looks like it was acheived by using ActionScript to draw three rectangles of decreasing opacity.

Posted by: Michael Jordan at August 10, 2004 02:49 PM

I'm trying to see the need to create a Flash widget for a simple text menu. Why not just use simple text for a simple text menu and get it all over with? Funky fresh rollovers can be created rather nicely using CSS techniques, if you must.

It's automatically more accessible by definition, provides the proper tabbing as-is, and is standards-complaint right out of the box. It is also a hell of a lot lighter than a Flash widget of comparable functionality would be.

Posted by: Frank Haynes at August 11, 2004 11:47 AM

Context is everything.

I would not advocate using Flash just to render text at this stage - though I am seeing some interesting projects underway. For now, you are correct, html with CSS does all the funky fresh stuff a growing desinger needs.

However, in cases where Flash is required and buttons are created, these issues come into the fray.

Hope that helps.

Posted by: Bob Regan at August 13, 2004 11:04 AM