Skip to content

bug: formAssociated: true should add "name" as an attribute to the element #6555

@emandirola

Description

@emandirola

Prerequisites

Stencil Version

4.41.2

Current Behavior

The docs (https://stenciljs.com/docs/form-associated#creating-a-form-associated-component) have an example of a form associated element, when you try to use it as in the example it doesn't compile since name is not an attribute of custom-text-input.

Expected Behavior

form-associated elements should have a name attribute so that it can be associated to a wrapping form.

System Info

System: node 24.7.0
    Platform: linux (6.17.0-8-generic)
   CPU Model: Intel(R) Core(TM) Ultra 7 165H (22 cpus)
       Build: 1768558830
     Stencil: 4.41.2 🐝
  TypeScript: 5.8.3
      Rollup: 4.34.9
      Parse5: 7.2.1
      jQuery: 4.0.0-pre
      Terser: 5.37.0

Steps to Reproduce

Add formAssociated: true to a component.
Add a name attribute to the tag when using it in jsx.

Code Reproduction URL

https://github.com/emandirola/form-associated-repro

Additional Information

I guess we can work around it by adding a prop "name" but it's weird that it just works when using html but not when using jsx.

Metadata

Metadata

Assignees

Labels

Bug: ValidatedThis PR or Issue is verified to be a bug within Stencil

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions