ADA compliance problem with Jtransform plugin

ADA compliance problem with Jtransform plugin

Hi ,

I am using the jquery transform , for a custom drop down box. I have added keyboard navigation , to the drop down box. I still need to make it ADA compliant. It doesnt read the names of the state when i navigate using keyboard. I dont get consistent results.  I have included the code below ----------- any thoughts ??


jtransform  code


(function($){
    $(function(){
        $('form').jqTransform();
    });

    /* Label Code */
    var jqTransformGetLabel = function(){};
   
    /* Hide all open selects */
    var jqTransformHideSelect = function(oTarget){
        var ulVisible = $('.jqTransformSelectWrapper ul:visible');
        ulVisible.each(function(){
            var oSelect = $(this).parents(".jqTransformSelectWrapper:first").find("select").get(0);
            //do not hide if click on the label object associated to the select
            if( !(oTarget && oSelect.oLabel && oSelect.oLabel.get(0) == oTarget.get(0)) ){$(this).hide();}
        });
    };

    /* Select Code */
    $.fn.jqTransSelect = function(){
        return this.each(function(index){
            var $select = $(this);

            if($select.hasClass('jqTransformHidden')) {return;}
            if($select.attr('multiple')) {return;}

            var oLabel  =  jqTransformGetLabel($select);
            /* First thing we do is Wrap it */
            var $wrapper = $select
                .addClass('jqTransformHidden')
                .wrap('<div class="jqTransformSelectWrapper" tabindex="1"></div>')
                .parent()
                .css({zIndex: 10-index})
            ;
           
            /* Now add the html for the select */
            $wrapper.prepend('<div><span></span><a href="#" class="jqTransformSelectOpen"></a></div><ul role="menu"></ul>');
            var $ul = $('ul', $wrapper).css('width',$select.width()).hide();
            /* Now we add the options */
            $('option', this).each(function(i){
                var oLi = $('<li role="menuitem"><a href="#" index="'+ i +'">'+ $(this).html() +'</a></li>');
                $ul.append(oLi);
            });
           
            /* Add click handler to the a */
            $ul.find('a').click(function(){
                    $('a.selected', $wrapper).removeClass('selected');
                    $(this).addClass('selected');   
                    //$(this).focus();
                    /* Fire the onchange event */
                    if ($select[0].selectedIndex != $(this).attr('index') && $select[0].onchange) { $select[0].selectedIndex = $(this).attr('index'); $select[0].onchange(); }
                    $select[0].selectedIndex = $(this).attr('index');
                    $('span:eq(0)', $wrapper).html($(this).html());
                    $ul.hide();
                    return false;
            });
            /* Set the default */
            $('a:eq('+ this.selectedIndex +')', $ul).click();
            $('span:first', $wrapper).click(function(){$("a.jqTransformSelectOpen",$wrapper).trigger('click');});
            oLabel && oLabel.click(function(){$("a.jqTransformSelectOpen",$wrapper).trigger('click');});
            this.oLabel = oLabel;
           
            /* Apply the click handler to the Open */
            var oLinkOpen = $('a.jqTransformSelectOpen', $wrapper)
                .click(function(){
                    //Check if box is already open to still allow toggle, but close all other selects
                    if( $ul.css('display') == 'none' ) {jqTransformHideSelect();}
                    if($select.attr('disabled')){return false;}

                    $ul.slideToggle('fast', function(){                   
                    //    var offSet = ($('a.selected', $ul));
                        //$ul.animate({scrollTop: offSet});
                    });
                    return false;
                });

            // Calculate the height if necessary, less elements that the default height
            //show the ul to calculate the block, if ul is not displayed li height value is 0
            $ul.css({display:'block',visibility:'hidden'});
            var iSelectHeight = ($('li',$ul).length)*($('li:first',$ul).height());//+1 else bug ff
            (iSelectHeight < $ul.height()) && $ul.css({height:iSelectHeight,'overflow':'hidden'});//hidden else bug with ff
            $ul.css({display:'none',visibility:'visible'});           
        });
    };
    $.fn.jqTransform = function(){
        return this.each(function(){
            var selfForm = $(this);
            if(selfForm.hasClass('jqtransformdone')) {return;}
            selfForm.addClass('jqtransformdone');
   
            if( $('select', this).jqTransSelect().length > 0 ){}
            selfForm.bind('reset',function(){var action = function(){jqTransformReset(this);}; window.setTimeout(action, 10);});
        });           
    };
})(jQuery);
       
       
       
$(document).ready(function() {

   
$('.jqTransformSelectWrapper').keypress(
function(event){

var code=event.keyCode;
var currentitem=$('.jqTransformSelectWrapper a.selected').attr('index');
//////Down arrow
if(code.toString() == 40){
currentitem=eval(currentitem)+1;
$('a:eq('+currentitem +')','ul').trigger('click');
}
//////Up arrow
if(code.toString() == 38){
currentitem=eval(currentitem)-1;
$('a:eq('+currentitem +')','ul').trigger('click');
}

//$('a:eq('+currentitem +')','ul').focus();
});
});

------------------------------------------------------------------------------------------------------------------------

html code :

<body>
<div class="state-selector-module">
    <div class="state-form">
        <form>
            <label for="stateselect">Information for:</label>
            <div class="state-dropdown">
                <select name="stateselect" id="stateselect" title="Select account location">
                    <option value=" " selected="selected">Select account location</option>
                    <option value="AL">Alabama</option>
                    <option value="AK" >Alaska</option>
                    <option value="AZ">Arizona</option>
                    <option value="AR">Arkansas</option>
                    <option value="CA">California</option>
                    <option value="CO">Colorado</option>
                    <option value="CT">Connecticut</option>
                    <option value="DE">Delaware</option>
                    <option value="DC">District of Columbia</option>
                    <option value="FL">Florida</option>
                    <option value="GA">Georgia</option>
                    <option value="HI">Hawaii</option>
                    <option value="ID">Idaho</option>
                    <option value="IL">Illinois</option>
                    <option value="IN">Indiana</option>
                    <option value="IA">Iowa</option>
                    <option value="KS">Kansas</option>
                    <option value="KY">Kentucky</option>
                    <option value="LA">Louisiana</option>
                    <option value="ME">Maine</option>
                    <option value="MD">Maryland</option>
                    <option value="MA">Massachusetts</option>
                    <option value="MI">Michigan</option>
                    <option value="MN">Minnesota</option>
                    <option value="MS">Mississippi</option>
                    <option value="MO">Missouri</option>
                    <option value="MT">Montana</option>
                    <option value="NE">Nebraska</option>
                    <option value="NV">Nevada</option>
                    <option value="NH">New Hampshire</option>
                    <option value="NJ">New Jersey</option>
                    <option value="NM">New Mexico</option>
                    <option value="NY">New York</option>
                    <option value="NC">North Carolina</option>
                    <option value="ND">North Dakota</option>
                    <option value="OH">Ohio</option>
                    <option value="OK">Oklahoma</option>
                    <option value="OR">Oregon</option>
                    <option value="PA">Pennsylvania</option>
                    <option value="RI">Rhode Island</option>
                    <option value="SC">South Carolina</option>
                    <option value="SD">South Dakota</option>
                    <option value="TN">Tennessee</option>
                    <option value="TX">Texas</option>
                    <option value="UT">Utah</option>
                    <option value="VT">Vermont</option>
                    <option value="VA">Virginia</option>
                    <option value="WA">Washington</option>
                    <option value="WV">West Virginia</option>
                    <option value="WI">Wisconsin</option>
                    <option value="WY">Wyoming</option>
                </select>
            </div>
            <div class="state-go"><a class="blue-button" href="#" title=""><span>Go</span></a></div>
        </form>
        <div class="clearboth"></div>
    </div>


-----------------------------------------------------------------------------------