Skip to content

Form: Support standalone nested forms (opt out of parent attachment) #3849

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
NilsEvers opened this issue Apr 10, 2025 · 1 comment · Fixed by #3939
Closed

Form: Support standalone nested forms (opt out of parent attachment) #3849

NilsEvers opened this issue Apr 10, 2025 · 1 comment · Fixed by #3939
Assignees
Labels
enhancement New feature or request v3 #1289

Comments

@NilsEvers
Copy link
Contributor

Description

When a Form component is nested inside another Form, the inner form automatically attaches to the parent and is rendered as a <div> instead of a <form> element.

This causes issues in scenarios where a form element contains a child form — for example, a rich text editor that opens a dialog with its own Form to insert a link or media.

Currently, the form bus is always injected if a parent form exists:

const parentBus = inject(

Which renders the component as a div:

:is="parentBus ? 'div' : 'form'"

There should be a way to opt out of this behavior. For example, a prop like standalone that prevents the form from attaching to a parent form, and ensures it renders as a proper <form> element.

Additional context

No response

@NilsEvers NilsEvers added enhancement New feature or request triage v3 #1289 labels Apr 10, 2025
@romhml romhml self-assigned this Apr 10, 2025
@romhml romhml removed the triage label Apr 10, 2025
@florian2peaches
Copy link

This is also a problem for forms inside a Dialog/Portal which is included inside a form, since context is passed through to the portal. There, the form is not even nested, just the context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request v3 #1289
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants