Skip to content

Commit f09f8da

Browse files
author
Scott Hamper
committed
Fixed bug that left a '-1' tabindex on a select after destroying selectize
Selectize sets a '-1' tabindex on the original select element when initialized. When the select element did not originally have a tabindex set, Selectize would not properly remove the '-1' tabindex when destroying itself.
1 parent 0ad43dc commit f09f8da

File tree

6 files changed

+10
-2
lines changed

6 files changed

+10
-2
lines changed

dist/js/selectize.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2192,6 +2192,7 @@
21922192
self.$input
21932193
.html('')
21942194
.append(revertSettings.$children)
2195+
.removeAttr('tabindex')
21952196
.attr({tabindex: revertSettings.tabindex})
21962197
.show();
21972198

dist/js/selectize.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/standalone/selectize.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2776,6 +2776,7 @@
27762776
self.$input
27772777
.html('')
27782778
.append(revertSettings.$children)
2779+
.removeAttr('tabindex')
27792780
.attr({tabindex: revertSettings.tabindex})
27802781
.show();
27812782

dist/js/standalone/selectize.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/selectize.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,6 +1752,7 @@ $.extend(Selectize.prototype, {
17521752
self.$input
17531753
.html('')
17541754
.append(revertSettings.$children)
1755+
.removeAttr('tabindex')
17551756
.attr({tabindex: revertSettings.tabindex})
17561757
.show();
17571758

test/api.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,11 @@
549549
expect(test.$select.html()).to.be.equal(children);
550550
expect(test.$select.attr('tabindex')).to.be.equal('9999');
551551
});
552+
it('should remove tabindex if it was originally undefined', function() {
553+
var test = setup_test('<select>', {});
554+
test.selectize.destroy();
555+
expect(test.$select.attr('tabindex')).to.be.equal(undefined);
556+
});
552557
});
553558

554559
});

0 commit comments

Comments
 (0)