Skip to content

aria-disabled buttons should have same CSS as disabled #39727

@coliff

Description

@coliff

If you're building a form then you may want the submit button to be disabled until the form has been completed correctly. Using the disabled attribute on the submit button will however not allow the user to tab to it.

A better solution could to be disable click events on the submit button and make the button be announced as disabled with the aria-disabled="true" attribute. If you do that with Bootstrap though it doesn't use the disabled state button CSS. (Quick demo: https://stackblitz.com/edit/bootstrap-disabled-buttons )

I read about this on: https://a11y-101.com/development/aria-disabled

TLDR: A disabled button currently has CSS something like this:

.btn.disabled, .btn:disabled, fieldset:disabled .btn {
   ....
}

I suggest it should include aria-disabled="true" buttons so compiled CSS would be:

.btn.disabled, .btn:disabled, fieldset:disabled .btn, .btn.aria-disabled="true" {
    ....
}

I know there are more accessibility considerations regarding my form scenario example mentioned above, but I still think it probably makes sense for aria-disabled="true" buttons to use the same styles as disabled buttons.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions