Skip to content

feat: Remove discrepancy between formAssociated bool resolving and normal bool Props #6906

Description

@FabioGimmillaro

Prerequisites

Describe the Feature Request

There is a discrepancy between resolving formAssociated bool properties vs normal bool properties.

formAssociated bool properties are resolved like this:

  • disabled="" // true
  • disabled="true" // true
  • disabled="false" // true
  • // false

while normal bool properties are resolved like this:

  • disabeld="" // true
  • disabled="true" // true
  • disabled="false" // false <=========== !!!
  • // false

There should be an stencil.config option where we can force other bool properties to behave like formAssociated bool properties

Describe the Use Case

There should be a consistency on how Properties of the same type are resolved independent on whether they are formAssociated properties or not

Describe Preferred Solution

The preferred solution would be to unify the behavior consistently.
Add a stencil.config option { resolveBoolAttributes: "native" | "falseEqualsFalse" } (I'm bad at naming types :D) which has the current behavior as default and for future major versions is changed to the native behavior

Describe Alternatives

  • Add a stencil.config option and keep the current default behavior
  • OR formAssociated bool props should be resolved like other bool props in Stencil

Related Code

I also added a bug, because the current behavior for formAssociated bool props is broken: #6905

Additional Information

No response

Activity

  1. johnjenkins commented on Sep 24, 2026

    @johnjenkins
    Contributor

    hey @FabioGimmillaro thanks for raising - yes I know Stencil is weird around bool and string false. Thanks for reminding me I did plan to remove the behaviour in v5 :)

  2. added
    Stencil v5
    on Sep 24, 2026
  3. visualkhh commented on Nov 1, 2026

    @visualkhh

    Hit the same inconsistency from the other side, and the native rule settles which direction unification should go. Verified in Chromium just now:

    • setAttribute('disabled', '') → disabled === true
    • setAttribute('disabled', 'false') → disabled === true (presence wins, value ignored)
    • setAttribute('disabled', '0') → true
    • absent → false

    So the browser has exactly one rule — presence — with no string sniffing at all. The disabled="false" → false behavior of normal Stencil bool props matches no browser; it's a DX invention (a popular one — I use @dooboostore/simple-web-component, which does the same 'false'/'0' → false carve-out and documents it as a deliberate deviation from native).

    For the proposed resolveBoolAttributes option, that gives a clean definition of "native": presence-only, i.e. today's formAssociated behavior extended everywhere. And it makes "falseEqualsFalse" honestly named as the legacy DX mode rather than the default-looking one. One test worth pinning either way: disabled="" must read true under both modes (that's the case #6963 tripped on — empty string collapsing into the false default), so the two modes differ only on the literal 'false'/'0' strings, never on presence itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stencil v5

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions