mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
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.
This commit is contained in:
parent
97b4813f30
commit
86a958d3aa
@ -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>
|
||||
|
@ -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);
|
||||
|
8
ui/jquery.ui.core.js
vendored
8
ui/jquery.ui.core.js
vendored
@ -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[ ":" ], {
|
||||
|
Loading…
Reference in New Issue
Block a user