Skip to content

Improve handling under iOS #1127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
* Fix open keyboard bug under iOS after closing selection (#1127)

*@zeitiger*

* Fix highlighting more than one character (#1099, #1098)

*@skimi*
Expand Down
1 change: 1 addition & 0 deletions src/selectize.js
Original file line number Diff line number Diff line change
Expand Up @@ -1741,6 +1741,7 @@ $.extend(Selectize.prototype, {

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

self.isOpen = false;
Expand Down
33 changes: 25 additions & 8 deletions test/interaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,34 @@

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

click(test.selectize.$control, function() {
click($('[data-value=a]', test.selectize.$dropdown_content), function() {
expect(test.selectize.isOpen).to.be.equal(false);
expect(test.selectize.isFocused).to.be.equal(true);
done();
});
click(test.selectize.$control, function() {
click($('[data-value=a]', test.selectize.$dropdown_content), function() {
expect(test.selectize.isOpen).to.be.equal(false);
expect(test.selectize.isFocused).to.be.equal(true);
done();
});
});
});

it('should close and blur dropdown after selection made if closeAfterSelect: true and in single mode' , function(done) {
var test = setup_test('<select>' +
'<option value="a">A</option>' +
'<option value="b">B</option>' +
'</select>', {closeAfterSelect: true});

click(test.selectize.$control, function() {
expect(test.selectize.isOpen).to.be.equal(true);
expect(test.selectize.isFocused).to.be.equal(true);
click($('[data-value=a]', test.selectize.$dropdown_content), function() {
expect(test.selectize.isOpen).to.be.equal(false);
expect(test.selectize.isFocused).to.be.equal(false);
done();
});
});
});

describe('clicking control', function() {
Expand Down