]> source.dussan.org Git - jquery-ui.git/commitdiff
Core: Update :focsable and :tabbable to handle parents with no height/width, but...
authorScott González <scott.gonzalez@gmail.com>
Tue, 23 Oct 2012 19:12:54 +0000 (15:12 -0400)
committerScott González <scott.gonzalez@gmail.com>
Tue, 23 Oct 2012 19:12:54 +0000 (15:12 -0400)
tests/unit/core/core.html
tests/unit/core/selector.js
ui/jquery.ui.core.js

index e259f3270d7b2573b79487535910f6b8adb0623c..41c8db827389db61356906caa9b86d1ebb45a15a 100644 (file)
        <span id="spanTabindex-50" tabindex="-50">.</span>
 </div>
 
+<div style="width: 0; height: 0;">
+       <input id="dimensionlessParent">
+       <input id="dimensionlessParent-dimensionless" style="height: 0; width: 0;">
+</div>
+
 <div id="zIndex100" style="z-index: 100; position: absolute">
        <div id="zIndexAutoWithParent">.</div>
 </div>
index 7876cdd07fd95a679c3899ba464d3156191ef7d7..f30ad17bec030a5af99ad6ca0b9bf0dc620b94d9 100644 (file)
@@ -157,6 +157,12 @@ test("focusable - area elements", function() {
        isNotFocusable('#areaNoImg', 'not associated with an image');
 });
 
+test( "focusable - dimensionless parent with overflow", function() {
+       expect( 1 );
+
+       isFocusable( "#dimensionlessParent", "input" );
+});
+
 test("tabbable - visible, enabled elements", function() {
        expect(18);
 
@@ -236,4 +242,10 @@ test("tabbable - area elements", function() {
        isNotTabbable('#areaNoImg', 'not associated with an image');
 });
 
+test( "tabbable - dimensionless parent with overflow", function() {
+       expect( 1 );
+
+       isTabbable( "#dimensionlessParent", "input" );
+});
+
 })(jQuery);
index e569eea423fba1979db5a263bd02c024ad7e0978..2e9d53ae3499d5ef7cc746caa783b7ce20e63c13 100644 (file)
@@ -198,10 +198,10 @@ function focusable( element, isTabIndexNotNaN ) {
 }
 
 function visible( element ) {
-       return !$( element ).parents().andSelf().filter(function() {
-               return $.css( this, "visibility" ) === "hidden" ||
-                       $.expr.filters.hidden( this );
-       }).length;
+       return $.expr.filters.visible( element ) &&
+               !$( element ).parents().andSelf().filter(function() {
+                       return $.css( this, "visibility" ) === "hidden";
+               }).length;
 }
 
 $.extend( $.expr[ ":" ], {