Skip to content

Commit 67e4b44

Browse files
committed
Core: provide "includeHidden" parameter in $.ui.scrollParent
Even though the user is unable to scroll via the UI, authors may have custom scrollbars that programmatically set scrollTop. Therefore, overflow:hidden can be considered a scrollParent.
1 parent 2ac0769 commit 67e4b44

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ui/core.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,16 @@ $.extend( $.ui, {
4848

4949
// plugins
5050
$.fn.extend({
51-
scrollParent: function() {
51+
scrollParent: function( includeHidden ) {
5252
var position = this.css( "position" ),
5353
excludeStaticParent = position === "absolute",
54+
overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
5455
scrollParent = this.parents().filter( function() {
5556
var parent = $( this );
5657
if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
5758
return false;
5859
}
59-
return (/(auto|scroll)/).test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) );
60+
return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) );
6061
}).eq( 0 );
6162

6263
return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent;

0 commit comments

Comments
 (0)