<div id="visibilityHiddenAncestor" style="visibility: hidden;">
<input id="visibilityHiddenAncestor-input">
<span tabindex="1" id="visibilityHiddenAncestor-span">.</span>
+
+ <span id="nestedVisibilityOverrideAncestor" style="visibility: visible">
+ <input id="nestedVisibilityOverrideAncestor-input">
+ <span tabindex="1" id="nestedVisibilityOverrideAncestor-span">.</span>
+ </span>
</div>
<span tabindex="1" id="displayNone-span" style="display: none;">.</span>
} );
test( "focusable - hidden styles", function() {
- expect( 8 );
+ expect( 10 );
isNotFocusable( "#displayNoneAncestor-input", "input, display: none parent" );
isNotFocusable( "#displayNoneAncestor-span", "span with tabindex, display: none parent" );
isNotFocusable( "#visibilityHiddenAncestor-input", "input, visibility: hidden parent" );
isNotFocusable( "#visibilityHiddenAncestor-span", "span with tabindex, visibility: hidden parent" );
+ isFocusable( "#nestedVisibilityOverrideAncestor-input", "input, visibility: visible parent but visibility: hidden grandparent" );
+ isFocusable( "#nestedVisibilityOverrideAncestor-span", "span with tabindex, visibility: visible parent but visibility: hidden grandparent " );
+
isNotFocusable( "#displayNone-input", "input, display: none" );
isNotFocusable( "#visibilityHidden-input", "input, visibility: hidden" );
} );
test( "tabbable - hidden styles", function() {
- expect( 8 );
+ expect( 10 );
isNotTabbable( "#displayNoneAncestor-input", "input, display: none parent" );
isNotTabbable( "#displayNoneAncestor-span", "span with tabindex, display: none parent" );
isNotTabbable( "#visibilityHiddenAncestor-input", "input, visibility: hidden parent" );
isNotTabbable( "#visibilityHiddenAncestor-span", "span with tabindex, visibility: hidden parent" );
+ isTabbable( "#nestedVisibilityOverrideAncestor-input", "input, visibility: visible parent but visibility: hidden grandparent" );
+ isTabbable( "#nestedVisibilityOverrideAncestor-span", "span with tabindex, visibility: visible parent but visibility: hidden grandparent " );
+
isNotTabbable( "#displayNone-input", "input, display: none" );
isNotTabbable( "#visibilityHidden-input", "input, visibility: hidden" );
if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
return false;
}
- img = $( "img[usemap='#" + mapName + "']" )[ 0 ];
- return !!img && visible( img );
+ img = $( "img[usemap='#" + mapName + "']" );
+ return img.length > 0 && img.is( ":visible" );
}
return ( /^(input|select|textarea|button|object)$/.test( nodeName ) ?
!element.disabled :
"a" === nodeName ?
element.href || hasTabindex :
hasTabindex ) &&
-
- // The element and all of its ancestors must be visible
- visible( element );
+ $( element ).is( ":visible" ) && $( element ).css( "visibility" ) === "visible";
};
-function visible( element ) {
- return $.expr.filters.visible( element ) &&
- !$( element ).parents().addBack().filter( function() {
- return $.css( this, "visibility" ) === "hidden";
- } ).length;
-}
-
$.extend( $.expr[ ":" ], {
focusable: function( element ) {
return $.ui.focusable( element, $.attr( element, "tabindex" ) != null );