Skip to content

Commit

Permalink
MDL-42928 JavaScript: Disable lockScroll for small chooserdialogues
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Jan 28, 2014
1 parent 73747ae commit 478d82d
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
Expand Up @@ -215,6 +215,20 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
}
}

// If the dialogue is larger than a reasonable minimum height, we
// disable the page scrollbars.
if (newheight > this.get('minheight')) {
// Disable the page scrollbars.
if (this.panel.lockScroll && !this.panel.lockScroll.isActive()) {
this.panel.lockScroll.enableScrollLock();
}
} else {
// Re-enable the page scrollbars.
if (this.panel.lockScroll && this.panel.lockScroll.isActive()) {
this.panel.lockScroll.disableScrollLock();
}
}

// Take off 15px top and bottom for borders, plus 40px each for the title and button area before setting the
// new max-height
totalheight = newheight;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -215,6 +215,20 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
}
}

// If the dialogue is larger than a reasonable minimum height, we
// disable the page scrollbars.
if (newheight > this.get('minheight')) {
// Disable the page scrollbars.
if (this.panel.lockScroll && !this.panel.lockScroll.isActive()) {
this.panel.lockScroll.enableScrollLock();
}
} else {
// Re-enable the page scrollbars.
if (this.panel.lockScroll && this.panel.lockScroll.isActive()) {
this.panel.lockScroll.disableScrollLock();
}
}

// Take off 15px top and bottom for borders, plus 40px each for the title and button area before setting the
// new max-height
totalheight = newheight;
Expand Down
14 changes: 14 additions & 0 deletions lib/yui/src/chooserdialogue/js/chooserdialogue.js
Expand Up @@ -213,6 +213,20 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
}
}

// If the dialogue is larger than a reasonable minimum height, we
// disable the page scrollbars.
if (newheight > this.get('minheight')) {
// Disable the page scrollbars.
if (this.panel.lockScroll && !this.panel.lockScroll.isActive()) {
this.panel.lockScroll.enableScrollLock();
}
} else {
// Re-enable the page scrollbars.
if (this.panel.lockScroll && this.panel.lockScroll.isActive()) {
this.panel.lockScroll.disableScrollLock();
}
}

// Take off 15px top and bottom for borders, plus 40px each for the title and button area before setting the
// new max-height
totalheight = newheight;
Expand Down

0 comments on commit 478d82d

Please sign in to comment.