Repository navigation
fix(runtime): form-associated boolean attribute "false" parses as true - #6908
Merged
Merged
Conversation
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]>
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.
This was referenced Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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@Proptofalse. The browser treats the attribute as present, so the element is natively disabled while the prop says otherwise.#6280 made
parsePropertyValue()treat any string astruefor form-associated components. #6413 later added a boolean coercion inattributeChangedCallbackthat turns"false"into booleanfalsebefore the setter runs, soparsePropertyValue()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)
attributeChangedCallbackonly turns"false"intofalsefor components that aren't form-associated. Form-associated components treat any present attribute astrue, and removal asfalse.