Skip to content

fix(runtime): form-associated boolean attribute "false" parses as true - #6908

Merged
johnjenkins merged 1 commit into
mainfrom
fix/form-associated-bool-attr
Sep 24, 2026
Merged

johnjenkins merged 1 commit into
mainfrom
fix/form-associated-bool-attr

Conversation

@johnjenkins

@johnjenkins johnjenkins commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

What is the current behavior?

For form-associated components, a boolean attribute set from HTML or setAttribute() with the value "false" (e.g. <my-cmp disabled="false">) resolves the @Prop to false. The browser treats the attribute as present, so the element is natively disabled while the prop says otherwise.

#6280 made parsePropertyValue() treat any string as true for form-associated components. #6413 later added a boolean coercion in attributeChangedCallback that turns "false" into boolean false before the setter runs, so parsePropertyValue() never sees the string and the form-associated branch is skipped. The existing wdio test sets the value through JSX (property path), so it didn't catch this.

What is the new behavior?

Fixes #6905 (regressed in v4.38.1, not 4.41.3 as reported)

attributeChangedCallback only turns "false" into false for components that aren't form-associated. Form-associated components treat any present attribute as true, and removal as false.

attributeChangedCallback coerced the string "false" to boolean false before
the setter ran, bypassing the form-associated handling in parsePropertyValue.
Regressed in #6413.

Fixes #6905

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@johnjenkins
johnjenkins requested a review from a team as a code owner September 24, 2026 12:36
@johnjenkins
johnjenkins merged commit f971133 into main Sep 24, 2026
31 checks passed
nicolatamburini added a commit to magma-design-system/magma that referenced this pull request Oct 19, 2026
…components

Since stenciljs/core#6908, in Stencil 4.45.2, a form-associated component
reads a present boolean attribute as set, "false" included, as a native
control does. React 18 writes a prop set to false on a bare custom element
as the attribute "false": a control switched off, or an arg or a state set
to false, left the prop on, and the Disabled story of mds-button started
disabled.

The stories now render through a JSX runtime that leaves the false props
of the form-associated components out. The plays of the mds-button
Disabled story and of the mds-input-otp FormIntegration story cover the
switch from true to false and the spread args.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: formAssociated disabled property is parsed as false although it is truthy

1 participant