twbs / bootlint

HTML linter for Bootstrap projects
MIT License
2.4k stars 312 forks source link

I am getting W016 for buttons disabled through button.js's loading state #379

Closed Herst closed 8 years ago

Herst commented 8 years ago

I know that the button loading state feature is going to be removed but it's still strange that it itself would trigger a warning.

What I'm getting while a button is in the "loading" state:

Using the `.disabled` class on a `<button>` or `<input>` only changes the appearance of the element. It doesn't prevent the user from interacting with the element (for example, clicking on it or focusing it). If you want to truly disable the element, use the `disabled` attribute instead.

/edit: I am now coming to the conclusion that this warning is actually correct in that it rightly points out how Bootstrap's (v3) button.js is adding .disabled for no good reason. This is why I have opened an issue at the Bootstrap bug tracker now: https://github.com/twbs/bootstrap/issues/19961 So if this issue will be fixed on Bootstrap's side (even if it seems as if any but the most important changes to any v3 code is not welcome, after all it's feature-complete), this issue and my PR can be closed.

zacechola commented 8 years ago

Could you please post a reduced test case?

That warning suggests the button doesn't add the disabled attr to the button, but Bootstrap's button.js does that.

Herst commented 8 years ago

OK, will try. For now, here is the HTML of the button:

<button type="button" data-loading-text="Saving…" class="btn btn-primary disabled" id="btn-save-permanence" data-original-title="" title="" aria-describedby="popover498575" disabled="disabled">Saving…</button>

Oddly enough it seems to have the disabled attribute. /edit: But also the class → what matters.

Herst commented 8 years ago

@zacechola: I present to you the test case: https://jsfiddle.net/Herst/vmh8phxf/

Herst commented 8 years ago

BTW, the .disabled class is added in https://github.com/twbs/bootstrap/blob/master/js/button.js#L44

cvrebert commented 8 years ago

As noted in the Bootstrap bug, this is a minor bug in Bootstrap 3 itself. Since the Bootstrap feature in question is deprecated and since Bootlinting while a button is loading is relatively uncommon, I'm inclined to not make any changes to Bootlint here.