Skip to content

Commit 2adf9e8

Browse files
author
Carlos Lizaga
committed
Fixed unsafe comparison with a literal. No need to eslint eqeqeq.
Fixed enable method. It was not enabling and activating the collapsible. This was detected on Jasmine unit testing. Minor repositioning to this.options.disabled on disable method for consistency purposes with enable method.
1 parent 8595da6 commit 2adf9e8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/web/mage/collapsible.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ define([
243243
});
244244

245245
// For collapsible widget only (not tabs or accordion)
246-
if (this.header.parent().attr('role') != 'presentation') { //eslint-disable-line eqeqeq
246+
if (this.header.parent().attr('role') !== 'presentation') {
247247
this.header
248248
.parent()
249249
.attr('role', 'tablist');
@@ -316,9 +316,9 @@ define([
316316
* Disable.
317317
*/
318318
disable: function () {
319+
this.options.disabled = true;
319320
this._off(this.trigger);
320321
this.forceDeactivate();
321-
this.options.disabled = true;
322322

323323
if (this.options.disabledState) {
324324
this.element.addClass(this.options.disabledState);
@@ -330,12 +330,14 @@ define([
330330
* Enable.
331331
*/
332332
enable: function () {
333-
this._on(this.trigger, this.events);
334333
this.options.disabled = false;
334+
this._on(this.trigger, this.events);
335+
this.forceActivate();
335336

336337
if (this.options.disabledState) {
337338
this.element.removeClass(this.options.disabledState);
338339
}
340+
this.trigger.attr('tabIndex', 0);
339341
},
340342

341343
/**

0 commit comments

Comments
 (0)