Skip to content

Commit fd07c11

Browse files
committed
applied fix for select2#1172 - Clear button overlaps text
1 parent c7056ad commit fd07c11

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

select2.css

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ Version: @@ver@@ Timestamp: @@timestamp@@
8181
background-image: linear-gradient(top, #eeeeee 0%,#ffffff 90%);
8282
}
8383

84+
.select2-container.select2-allowclear .select2-choice span {
85+
margin-right: 42px;
86+
}
87+
8488
.select2-container .select2-choice span {
8589
margin-right: 26px;
8690
display: block;
@@ -94,11 +98,11 @@ Version: @@ver@@ Timestamp: @@timestamp@@
9498
}
9599

96100
.select2-container .select2-choice abbr {
97-
display: block;
101+
display: inline-block;
98102
width: 12px;
99103
height: 12px;
100104
position: absolute;
101-
right: 26px;
105+
right: 24px;
102106
top: 8px;
103107

104108
font-size: 1px;
@@ -171,7 +175,7 @@ Version: @@ver@@ Timestamp: @@timestamp@@
171175
}
172176

173177
.select2-container .select2-choice div {
174-
display: block;
178+
display: inline-block;
175179
width: 18px;
176180
height: 100%;
177181
position: absolute;

select2.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1940,6 +1940,7 @@ the specific language governing permissions and limitations under the Apache Lic
19401940

19411941
this.selection.addClass("select2-default");
19421942

1943+
this.container.removeClass("select2-allowclear");
19431944
this.selection.find("abbr").hide();
19441945
}
19451946
},
@@ -2018,6 +2019,7 @@ the specific language governing permissions and limitations under the Apache Lic
20182019
this.selection.removeClass("select2-default");
20192020

20202021
if (this.opts.allowClear && this.getPlaceholder() !== undefined) {
2022+
this.container.addClass("select2-allowclear");
20212023
this.selection.find("abbr").show();
20222024
}
20232025
},

0 commit comments

Comments
 (0)