Skip to content

Add "form" attribute to all components that render an <input>, <textarea> or <select> #4117

Closed
@tchak

Description

@tchak

🙋 Feature Request

Add "form" attribute to all components that render an <input>, <textarea> or <select>.

🤔 Expected Behavior

Be able to set form attribute on the internal <input>, <textarea> or <select>.

😯 Current Behavior

form attribute is not exposed.

💁 Possible Solution

I have tried to use ref and set form attribute in an useEffect. In some cases I am also using data-testid to gain access to underlying DOM/input and set form attribute in an useEffect. Neither is a good solution.

Another solution is to not use internal <input> (not set name on the component) and always use an external hidden <input>.

🔦 Context

It is more practical some time to render form and fields in separate parts of the DOM. For example, in cases when I want each field to have its own form. I can still group fields with one fieldset and put forms outside while referencing them from the inputs.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions