aboutsummaryrefslogtreecommitdiffstats
path: root/ui/focusable.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2015-09-25 10:33:58 -0400
committerScott González <scott.gonzalez@gmail.com>2015-09-29 12:48:11 -0400
commitd3025968f349c37a8ca41bfc63ee1b37d9d7354f (patch)
treeca9e9bfe5d96f783df37d6cd918898245bab1cce /ui/focusable.js
parent0bfbd21d4fefa98d165b7d50277bd23be84e919a (diff)
downloadjquery-ui-d3025968f349c37a8ca41bfc63ee1b37d9d7354f.tar.gz
jquery-ui-d3025968f349c37a8ca41bfc63ee1b37d9d7354f.zip
Focusable: Fix handling of `visibility: inherit`
Ref #14596 Ref gh-1583 Closes gh-1605
Diffstat (limited to 'ui/focusable.js')
-rw-r--r--ui/focusable.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/ui/focusable.js b/ui/focusable.js
index 942f0fed3..6b7a0b1f1 100644
--- a/ui/focusable.js
+++ b/ui/focusable.js
@@ -42,9 +42,20 @@ $.ui.focusable = function( element, hasTabindex ) {
"a" === nodeName ?
element.href || hasTabindex :
hasTabindex ) &&
- $( element ).is( ":visible" ) && $( element ).css( "visibility" ) === "visible";
+ $( element ).is( ":visible" ) && visible( $( element ) );
};
+// Support: IE 8 only
+// IE 8 doesn't resolve inherit to visible/hidden for computed values
+function visible( element ) {
+ var visibility = element.css( "visibility" );
+ while ( visibility === "inherit" ) {
+ element = element.parent();
+ visibility = element.css( "visibility" );
+ }
+ return visibility !== "hidden";
+}
+
$.extend( $.expr[ ":" ], {
focusable: function( element ) {
return $.ui.focusable( element, $.attr( element, "tabindex" ) != null );