Skip to content

Commit 4be1964

Browse files
committed
Fix open keyboard bug under iOS after closing selection
- tweak handling under iOS - improve blur handling and add option - improve pullrequest based on helpful feedback - change CHANGELOG
1 parent 0316d24 commit 4be1964

File tree

3 files changed

+30
-8
lines changed

3 files changed

+30
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
* Fix open keyboard bug under iOS after closing selection (#1127)
2+
3+
*@zeitiger*
4+
15
* Fix highlighting more than one character (#1099, #1098)
26

37
*@skimi*

src/selectize.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1741,6 +1741,7 @@ $.extend(Selectize.prototype, {
17411741

17421742
if (self.settings.mode === 'single' && self.items.length) {
17431743
self.hideInput();
1744+
self.$control_input.blur(); // close keyboard on iOS
17441745
}
17451746

17461747
self.isOpen = false;

test/interaction.js

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,34 @@
2929

3030
it('should close dropdown after selection made if closeAfterSelect: true', function(done) {
3131
var test = setup_test('<select multiple>' +
32-
'<option value="a">A</option>' +
33-
'<option value="b">B</option>' +
32+
'<option value="a">A</option>' +
33+
'<option value="b">B</option>' +
3434
'</select>', {closeAfterSelect: true});
3535

36-
click(test.selectize.$control, function() {
37-
click($('[data-value=a]', test.selectize.$dropdown_content), function() {
38-
expect(test.selectize.isOpen).to.be.equal(false);
39-
expect(test.selectize.isFocused).to.be.equal(true);
40-
done();
41-
});
36+
click(test.selectize.$control, function() {
37+
click($('[data-value=a]', test.selectize.$dropdown_content), function() {
38+
expect(test.selectize.isOpen).to.be.equal(false);
39+
expect(test.selectize.isFocused).to.be.equal(true);
40+
done();
4241
});
42+
});
43+
});
44+
45+
it('should close and blur dropdown after selection made if closeAfterSelect: true and in single mode' , function(done) {
46+
var test = setup_test('<select>' +
47+
'<option value="a">A</option>' +
48+
'<option value="b">B</option>' +
49+
'</select>', {closeAfterSelect: true});
50+
51+
click(test.selectize.$control, function() {
52+
expect(test.selectize.isOpen).to.be.equal(true);
53+
expect(test.selectize.isFocused).to.be.equal(true);
54+
click($('[data-value=a]', test.selectize.$dropdown_content), function() {
55+
expect(test.selectize.isOpen).to.be.equal(false);
56+
expect(test.selectize.isFocused).to.be.equal(false);
57+
done();
58+
});
59+
});
4360
});
4461

4562
describe('clicking control', function() {

0 commit comments

Comments
 (0)