diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-10-23 15:12:54 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-10-23 15:12:54 -0400 |
commit | 86a958d3aa04a5928484d16b27a4d3eea39142e4 (patch) | |
tree | 52fd0c86b08a9cacb1c866c4d3ce4197b868d29d | |
parent | 97b4813f30a0f197e96ec51bdd1d23cbc571add0 (diff) | |
download | jquery-ui-86a958d3aa04a5928484d16b27a4d3eea39142e4.tar.gz jquery-ui-86a958d3aa04a5928484d16b27a4d3eea39142e4.zip |
Core: Update :focsable and :tabbable to handle parents with no height/width, but visible overflow. Fixes #8643 - :focusable pseudo-selector does not find elements if parent has 0x0 dimension.
-rw-r--r-- | tests/unit/core/core.html | 5 | ||||
-rw-r--r-- | tests/unit/core/selector.js | 12 | ||||
-rw-r--r-- | ui/jquery.ui.core.js | 8 |
3 files changed, 21 insertions, 4 deletions
diff --git a/tests/unit/core/core.html b/tests/unit/core/core.html index e259f3270..41c8db827 100644 --- a/tests/unit/core/core.html +++ b/tests/unit/core/core.html @@ -112,6 +112,11 @@ <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> diff --git a/tests/unit/core/selector.js b/tests/unit/core/selector.js index 7876cdd07..f30ad17be 100644 --- a/tests/unit/core/selector.js +++ b/tests/unit/core/selector.js @@ -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); diff --git a/ui/jquery.ui.core.js b/ui/jquery.ui.core.js index e569eea42..2e9d53ae3 100644 --- a/ui/jquery.ui.core.js +++ b/ui/jquery.ui.core.js @@ -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[ ":" ], { |