aboutsummaryrefslogtreecommitdiffstats
path: root/ui/focusable.js
diff options
context:
space:
mode:
authorWeston Ruter <weston@xwp.co>2015-08-04 16:46:58 -0700
committerScott González <scott.gonzalez@gmail.com>2015-09-24 08:13:59 -0400
commit0db243a7369bc1e642a83d8b84be9437c360f7e2 (patch)
tree367b1b2bc448bc2f507ab7da4bca54f686a2a41d /ui/focusable.js
parent6308a261fd5d1be2362863e6a59fede4420d9f8c (diff)
downloadjquery-ui-0db243a7369bc1e642a83d8b84be9437c360f7e2.tar.gz
jquery-ui-0db243a7369bc1e642a83d8b84be9437c360f7e2.zip
Core: Remove ancestor visibility requirement from `:focusable` selector
* Check computed visibility in addition to :visible * Add tests for nested visibility override Fixes #14596 Closes gh-1583
Diffstat (limited to 'ui/focusable.js')
-rw-r--r--ui/focusable.js15
1 files changed, 3 insertions, 12 deletions
diff --git a/ui/focusable.js b/ui/focusable.js
index a50598cd4..942f0fed3 100644
--- a/ui/focusable.js
+++ b/ui/focusable.js
@@ -34,26 +34,17 @@ $.ui.focusable = function( element, hasTabindex ) {
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 );