Putting v-can on a button component causes the disabled attribute to be lost
See original GitHub issueI have a component like this:
<template>
<button
class="inline-block font-bold py-2 px-4 rounded text-xs bg-gray-200 text-600"
:type="type"><slot>Save</slot></button>
</template>
If I import it into another component as SecondarySaveButton
, then putting a v-can
directive on it oddly causes the disabled
attribute to be lost:
<secondary-save-button
v-can:tag-suggestions
name="save_tag"
:disabled="!canSubmitSuggestion">Add and tag</secondary-save-button>
If I wrap the component with a v-can
statement, the disabled
attribute is rendered as expected:
<span v-can:tag-suggestions>
<secondary-save-button
name="save_tag"
:disabled="!canSubmitSuggestion">Add and tag</secondary-save-button>
</span>
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Passing disabled attribute to an HTML element in a child ...
I found a solution in the last answer here: How to disable/hide a button as soon as clicked in Blazor? Even though SubmitSearch...
Read more >The Disabled Attribute in React Buttons - Upmostly
Disabled is an attribute passed to React buttons. This means that it is passed into button components within JSX. In App.js: App.js.
Read more >HTML attribute: disabled - HTML: HyperText Markup Language
The Boolean disabled attribute, when present, makes the element not mutable, focusable, or even submitted with the form. The user can ...
Read more >Exploring the difference between disabling a form control ...
Exploring the difference between disabling a form control through reactive forms API and HTML attributes. Having parts of a form disabled is a...
Read more >Making Disabled Buttons More Inclusive - CSS-Tricks
This button is disabled by the disabled attribute. (Note that this is a boolean attribute, which means that it can be written as...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The disabled attribute is always initialized with false (index.ts line 230). After commenting this line it was working for me.
But I don’t know if this causes other side effects.
Published version 0.15.4 with fix by @thomaslichtdotnet