Skip to content

Commit ef9f1de

Browse files
committed
Fix for drop-auto-width collision detection and css border top
- collision detection was not moving the drop left based on the difference between viewport and relative location of box (dropleft + dropwidth) - .select2-drop-active was overriding the .select2-drop-auto-width making the shifted dropbox look a bit wierd
1 parent cb5b684 commit ef9f1de

2 files changed

Lines changed: 10 additions & 11 deletions

File tree

select2.css

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Version: @@ver@@ Timestamp: @@timestamp@@
1818
/*
1919
Force border-box so that % widths fit the parent
2020
container without overlap because of margin/padding.
21-
2221
More Info : http://www.quirksmode.org/css/box.html
2322
*/
2423
-webkit-box-sizing: border-box; /* webkit */
@@ -145,15 +144,6 @@ Version: @@ver@@ Timestamp: @@timestamp@@
145144
box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
146145
}
147146

148-
.select2-drop-auto-width {
149-
border-top: 1px solid #aaa;
150-
width: auto;
151-
}
152-
153-
.select2-drop-auto-width .select2-search {
154-
padding-top: 4px;
155-
}
156-
157147
.select2-drop.select2-drop-above {
158148
margin-top: 1px;
159149
border-top: 1px solid #aaa;
@@ -174,6 +164,15 @@ Version: @@ver@@ Timestamp: @@timestamp@@
174164
border-top: 1px solid #5897fb;
175165
}
176166

167+
.select2-drop-auto-width {
168+
border-top: 1px solid #aaa;
169+
width: auto;
170+
}
171+
172+
.select2-drop-auto-width .select2-search {
173+
padding-top: 4px;
174+
}
175+
177176
.select2-container .select2-choice .select2-arrow {
178177
display: inline-block;
179178
width: 18px;

select2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,7 @@ the specific language governing permissions and limitations under the Apache Lic
12081208
}
12091209

12101210
if (!enoughRoomOnRight) {
1211-
dropLeft = offset.left + width - dropWidth;
1211+
dropLeft -= (dropLeft + dropWidth) - viewPortRight;
12121212
}
12131213

12141214
css = {

0 commit comments

Comments
 (0)