Skip to content

In Vue custom element, Boolean prop with default true cannot be updated to falsy value #12214

Closed
@lejunyang

Description

@lejunyang

Vue version

3.5.12

Link to minimal reproduction

https://play.vuejs.org/#eNqlVE2P0zAQ/SuDL0lENxUsXEpaQVEPcADEcrSEsumkZNexI3+UVlX/+07sJI1W3arSXpLx+L3x+PnZB/aladKtQzZjmSl01VgwaF0DIpebOWfWcLbgsqobpS0cQGM5gTWWlcSvzlhVrwTWKO2QVISUlIAjlFrVEFHxiEsuCyWNBdXYigKYw4FLgEarxsxCDFAqNcQAdt/gDJZKCczlpM/SMrkTdgZWO+yyx+5P/GWuX1EifL0AsW8t6WtpymkJcQLzBURtoxG8hTurK7kJ0JSSCeWivo1zAMonn/qVjr0o9Z70OCNq3KnVUgKylfeE7bUe4+isSojfFOM6Jt2gjaN6f2PR2ChJ4Nl0qHdCTKilUCwsu82FQ1qXTj/L5X4Rt8oFQDYNtiGT0MBi3YjcIo0AsntnrZLwuRBV8Uhm6su0bLIV6ezDbBqAl0llLkzP8vF1NCfD5tYddRhfR5dOiI7ZhteRoqijkBp2D8ab4BlVwzREneYwI3v0NTjzQ3LLKNPhr2Le3F+meh9dtWI2HZ0pm9CDQJYoq036YJSkV8PfD84KKlgJ1D+DEzkbbiFnuRDq/3efG9044vzD4vFM/sHs2hxnvzQa1FtqZZizuSYvh+nV3Q/cUTxM1mrtBKEvTP5Go4RrewywJfmB2h7hfLff/HtHp/bHrHYWpek35a07vBQklfPX8KWtn9q9TT94Hl17UvHvFnVbkwS8TT+m796z4xM7Itit

Steps to reproduce

click the buttons from left to right, observe the texts

What is expected?

Behavior of props default value in vue custom element should be same as in Vue component

What is actually happening?

We can see that boolean prop is always true in vue custom element no matter we set false, null, undefined or empty string, while in Vue component, false and null will be as it is, null, undefined and empty string will be default value

System Info

No response

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.scope: custom elements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions