r1479 - branches/experimental/tabbable

r1479 - branches/experimental/tabbable


Author: scott.gonzalez
Date: Fri Jan 2 08:47:42 2009
New Revision: 1479
Modified:
branches/experimental/tabbable/ui.core.js
Log:
Tabbable: Added support for using .setFocus() and an element that isn't
already focusable.
Modified: branches/experimental/tabbable/ui.core.js
==============================================================================
--- branches/experimental/tabbable/ui.core.js    (original)
+++ branches/experimental/tabbable/ui.core.js    Fri Jan 2 08:47:42 2009
@@ -39,8 +39,9 @@
    var element = this[0];
    
    if (element) {
-        // TODO: force tabindex if there is none
-//        $(element).attr('tabIndex', -1);
+        // ensure that the element is focusable
+        (isNaN($.attr(element, normalizedTabindex)) &&
+            $.attr(element, normalizedTabindex, -1));
        
        setTimeout(function() {
            element.focus();