[6.x] Add disabled prop to Button component#14047
Conversation
|
This might cause some accessibility issues in certain scenarios. The Using |
|
@daun Good catch, thanks! Just pushed up a version using |
|
What's the point of a disabled attribute on a html element if you can't use it? I think if you want to tell a button to be disabled, it should disable it. If you want it to be just aria-disabled, then explicitly do that instead. |
|
@jasonvarga I guess As a user, I'd prefer tabbing to a button that reads "Submit, disabled" to not finding a submit button at all. There's a few articles I found helpful when dealing with this in a recent project, e.g. Usability Pitfalls of Disabled Buttons and Making Disabled Buttons more Accessible. |
|
That's fine, but my point is that at the primitive component level, passing a disabled prop to it should just apply that. If in the context of where you're using that button that you want to maintain tabindex/aria/etc, then using |
|
Right, good point, makes sense to keep things literal on the primitive layer. It would be lovely if the above use-case was somehow supported by the UI layer though, e.g. using a <Button :disabled focusable v-tooltip="hint" @click="handleClick">Submit</Button>vs <span v-if="disabled" v-tooltip="hint" @click="handleClick" tabindex="0">
<Button disabled>Submit</button>
</span>
<Button v-else @click="handleClick">Submit</button> |
This pull request adds a
disabledprop to theButtoncomponent, like we have forInput.Fixes #14022