From 92357e61b8311cffbb29138835e3723dc2f6f499 Mon Sep 17 00:00:00 2001 From: jibwa Date: Wed, 18 Dec 2013 16:28:40 -0500 Subject: [PATCH] Fix problem with positioning the dropdown when it is on the right hand side of view In the stable version this line looks like: dropLeft = offset.left + width - dropWidth; In line (1193) the variable width is set to dropWidth which means we are always going to end up with dropLeft = offset.left + X - X or dropLeft = offset.left Which means we are still aligned to the left of the button. This current solution from @ef9f1dea is just aligning the select2-drop closer to the center which is not what it did before the dropdownAutoWidth. The line I submitted worked perfect and my dropdown now aligns to the RHS of the button again as expected. --- select2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/select2.js b/select2.js index 27e69442..67f6b85e 100644 --- a/select2.js +++ b/select2.js @@ -1208,7 +1208,7 @@ the specific language governing permissions and limitations under the Apache Lic } if (!enoughRoomOnRight) { - dropLeft -= (dropLeft + dropWidth) - viewPortRight; + dropLeft = offset.left + this.container.outerWidth(false) - dropWidth; } css = {