Skip to content

Commit e162a48

Browse files
committed
tweak how mask is created to remove jitter. fixes select2#1574
1 parent d479018 commit e162a48

2 files changed

Lines changed: 16 additions & 27 deletions

File tree

select2.css

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -114,25 +114,18 @@ Version: @@ver@@ Timestamp: @@timestamp@@
114114
cursor: pointer;
115115
}
116116

117-
.select2-drop-undermask {
118-
border: 0;
119-
margin: 0;
120-
padding: 0;
121-
position: absolute;
122-
left: 0;
123-
top: 0;
124-
z-index: 9998;
125-
background-color: transparent;
126-
filter: alpha(opacity=0);
127-
}
128-
129117
.select2-drop-mask {
130118
border: 0;
131119
margin: 0;
132120
padding: 0;
133-
position: absolute;
121+
position: fixed;
134122
left: 0;
135123
top: 0;
124+
min-height: 100%;
125+
min-width: 100%;
126+
height: auto;
127+
width: auto;
128+
opacity: 0;
136129
z-index: 9998;
137130
/* styles required for IE to work */
138131
background-color: #fff;

select2.js

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,7 @@ the specific language governing permissions and limitations under the Apache Lic
12621262
if (self.opts.selectOnBlur) {
12631263
self.selectHighlighted({noFocus: true});
12641264
}
1265-
self.close();
1265+
self.close({focus:false});
12661266
e.preventDefault();
12671267
e.stopPropagation();
12681268
}
@@ -1279,9 +1279,7 @@ the specific language governing permissions and limitations under the Apache Lic
12791279
this.dropdown.attr("id", "select2-drop");
12801280

12811281
// show the elements
1282-
maskCss=_makeMaskCss();
1283-
1284-
mask.css(maskCss).show();
1282+
mask.show();
12851283

12861284
this.dropdown.show();
12871285
this.positionDropdown();
@@ -1293,18 +1291,11 @@ the specific language governing permissions and limitations under the Apache Lic
12931291
var that = this;
12941292
this.container.parents().add(window).each(function () {
12951293
$(this).on(resize+" "+scroll+" "+orient, function (e) {
1296-
var maskCss=_makeMaskCss();
1297-
$("#select2-drop-mask").css(maskCss);
12981294
that.positionDropdown();
12991295
});
13001296
});
13011297

1302-
function _makeMaskCss() {
1303-
return {
1304-
width : Math.max(document.documentElement.scrollWidth, $(window).width()),
1305-
height : Math.max(document.documentElement.scrollHeight, $(window).height())
1306-
}
1307-
}
1298+
13081299
},
13091300

13101301
// abstract
@@ -1835,11 +1826,16 @@ the specific language governing permissions and limitations under the Apache Lic
18351826
},
18361827

18371828
// single
1838-
close: function () {
1829+
close: function (params) {
18391830
if (!this.opened()) return;
18401831
this.parent.close.apply(this, arguments);
1832+
1833+
params = params || {focus: true};
18411834
this.focusser.removeAttr("disabled");
1842-
this.focusser.focus();
1835+
1836+
if (params.focus) {
1837+
this.focusser.focus();
1838+
}
18431839
},
18441840

18451841
// single

0 commit comments

Comments
 (0)