This is a migrated thread and some comments may be shown as answers.

DropDownList selected style when tabbing

4 Answers 80 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Aaron
Top achievements
Rank 1
Aaron asked on 11 Oct 2011, 01:10 AM
Currently we are using DropDownList throughout our application.

We have an issue getting the DropDownList's to change style when tabbing to them, leading to confusion from users because they cannot tell which element on the form is selected.

The issue is evident on the Telerik demo page: http://demos.telerik.com/aspnet-mvc/combobox/clientsideapi
If you tab to the DropDownList you will find that there is not visual alert to the user that the element is selected.

Does anyone know of a solution/work around for this issue?

Edit: I found and changed this to suit:
http://www.telerik.com/community/forums/aspnet-mvc/combobox/change-border-on-focus.aspx

But this replaces the blur/focus events and stops the normal functionality of the dropdown to work.

Cheers
Aaron

4 Answers, 1 is accepted

Sort by
0
John DeVight
Top achievements
Rank 1
answered on 26 Oct 2011, 10:56 PM
Hi Aaron,

I have the same problem and also need to implement the same functionality.  I've taken the article that you mentioned and adapted it for a dropdown.  Everything works great when I tab to the dropdown, but when I click on the dropdown to show the list, the dropdown looses focus because the focus is now on the div that displays the list of items for the dropdown.  I'm working on figuring this out and will let you know what I come up with.  Here is what I have so far:

CSS:
div.dropDownHasFocus
{
    border-width: 1px;
    border-color: Gray;
    border-style: dotted;
}

JavaScript code:
$.find('.t-dropdown').bind({
    focus: function (e) {
        $(this).addClass('dropDownHasFocus');
    },
    blur: function (e) {
        $(this).removeClass('dropDownHasFocus');
    }
});

Regards,

John DeVight
0
John DeVight
Top achievements
Rank 1
answered on 28 Oct 2011, 04:16 PM
Hi Aaron,

I've gotten a bit farther with the javascript code and thought I would share.  It isn't perfect since focus is lost for a moment when the user clicks on the dropdown arrow to display the dropdown list items.

$.find('.t-dropdown').bind({
    focus: function (e) {
        $(this).addClass('dropDownHasFocus');
    },
    blur: function (e) {
        if($(this).find('input').data('tDropDownList').dropDown.isOpened()==false) {
            $(this).removeClass('dropDownHasFocus');
        }
    }
});
$.find(".t-dropdown input").each(function () {
    var dropdown=$(this).data('tDropDownList');
    dropdown.close=function (e) {
        this.dropDown.close();
        $(this.element).closest('.t-dropdown').focus();
    }
})

Hope this helps....

Regards,

John DeVight
telerikmvcextendedjs at gmail dot com
0
FinallyInSeattle
Top achievements
Rank 1
answered on 22 Nov 2011, 08:32 PM
I'm looking for a solution to this issue as well as this is both a usability and accessibility issue.  The last code above gives me the error: "Microsoft JScript runtime error: Object doesn't support property or method 'bind'" on the latest version of the controls.
0
FinallyInSeattle
Top achievements
Rank 1
answered on 30 Nov 2011, 09:53 PM
Is there a solution to this for the latest grid version (2011.3.1115.340)?  This version gives the error  "Microsoft JScript runtime error: Object doesn't support property or method 'bind'" on the code segment above.
Tags
ComboBox
Asked by
Aaron
Top achievements
Rank 1
Answers by
John DeVight
Top achievements
Rank 1
FinallyInSeattle
Top achievements
Rank 1
Share this question
or