From 697ecc725c406dee378999fc22b5ef14247033f2 Mon Sep 17 00:00:00 2001 From: C John Klehm Date: Wed, 11 Sep 2013 20:42:16 -0500 Subject: [PATCH 1/2] Prevent collapsed style overflow: hidden from obscuring the typeahead control's suggestion popup --- src/collapse/collapse.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/collapse/collapse.js b/src/collapse/collapse.js index d0a33b454f..45fb9e5cf5 100644 --- a/src/collapse/collapse.js +++ b/src/collapse/collapse.js @@ -7,14 +7,14 @@ angular.module('ui.bootstrap.collapse',['ui.bootstrap.transition']) // Unfortunately if you do this while the CSS transitions are specified (i.e. in the CSS class // "collapse") then you trigger a change to height 0 in between. // The fix is to remove the "collapse" CSS class while changing the height back to auto - phew! - var fixUpHeight = function(scope, element, height) { + var fixUpHeight = function(scope, element, height, isCollapsed) { // We remove the collapse CSS class to prevent a transition when we change to height: auto element.removeClass('collapse'); element.css({ height: height }); // It appears that reading offsetWidth makes the browser realise that we have changed the // height already :-/ var x = element[0].offsetWidth; - element.addClass('collapse'); + if (isCollapsed) element.addClass('collapse'); }; return { @@ -31,9 +31,9 @@ angular.module('ui.bootstrap.collapse',['ui.bootstrap.transition']) if (element[0].scrollHeight !== 0) { if (!isCollapsed) { if (initialAnimSkip) { - fixUpHeight(scope, element, element[0].scrollHeight + 'px'); + fixUpHeight(scope, element, element[0].scrollHeight + 'px', isCollapsed); } else { - fixUpHeight(scope, element, 'auto'); + fixUpHeight(scope, element, 'auto', isCollapsed); } } } @@ -65,7 +65,7 @@ angular.module('ui.bootstrap.collapse',['ui.bootstrap.transition']) if (initialAnimSkip) { initialAnimSkip = false; if ( !isCollapsed ) { - fixUpHeight(scope, element, 'auto'); + fixUpHeight(scope, element, 'auto', isCollapsed); } } else { doTransition({ height : element[0].scrollHeight + 'px' }) @@ -73,7 +73,7 @@ angular.module('ui.bootstrap.collapse',['ui.bootstrap.transition']) // This check ensures that we don't accidentally update the height if the user has closed // the group while the animation was still running if ( !isCollapsed ) { - fixUpHeight(scope, element, 'auto'); + fixUpHeight(scope, element, 'auto', isCollapsed); } }); } @@ -84,9 +84,9 @@ angular.module('ui.bootstrap.collapse',['ui.bootstrap.transition']) isCollapsed = true; if (initialAnimSkip) { initialAnimSkip = false; - fixUpHeight(scope, element, 0); + fixUpHeight(scope, element, 0, isCollapsed); } else { - fixUpHeight(scope, element, element[0].scrollHeight + 'px'); + fixUpHeight(scope, element, element[0].scrollHeight + 'px', isCollapsed); doTransition({'height':'0'}); } }; From 3b7fc810cb5bfbbcf41531bf23ae48e962407a3b Mon Sep 17 00:00:00 2001 From: C John Klehm Date: Wed, 11 Sep 2013 20:51:45 -0500 Subject: [PATCH 2/2] Add braces to a 1 line if to make TravisCI happy --- src/collapse/collapse.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/collapse/collapse.js b/src/collapse/collapse.js index 45fb9e5cf5..32242c9739 100644 --- a/src/collapse/collapse.js +++ b/src/collapse/collapse.js @@ -14,7 +14,9 @@ angular.module('ui.bootstrap.collapse',['ui.bootstrap.transition']) // It appears that reading offsetWidth makes the browser realise that we have changed the // height already :-/ var x = element[0].offsetWidth; - if (isCollapsed) element.addClass('collapse'); + if (isCollapsed) { + element.addClass('collapse'); + } }; return {