ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

feat: `form` property on form components

Open oliveryasuna opened this issue 1 year ago • 3 comments

Prerequisites

Describe the Feature Request

It seems that some of the form components support a form property. For example, ion-button, supports either string (standard, by ID) or HTMLFormElement, which is super useful.

I would love to see this property on other form components, such as ion-input and ion-checkbox.

Describe the Use Case

Associate form elements with a form, as per usual HTML forms.

Describe Preferred Solution

No response

Describe Alternatives

No response

Related Code

No response

Additional Information

No response

oliveryasuna avatar Apr 15 '24 22:04 oliveryasuna

Thanks for the issue! Could you please provide a use case for this?

brandyscarney avatar Apr 25 '24 15:04 brandyscarney

Thanks for the issue! Could you please provide a use case for this?

The form attribute exists so developers can associate inputs not children of a form element. It is standard HTML.

oliveryasuna avatar May 03 '24 18:05 oliveryasuna

@oliveryasuna the team is hoping to understand what limitations or challenges you have with the existing implementation to evaluate if the suggested feature would solve that problem.

Ionic's components are not a 1:1 API with built-in HTML elements. Adding support for a form element to a web component using shadow dom would not associate the form control to the form and would result in no added benefit to developers. Form association for shadow dom is handled by ElementInternals which Ionic Framework is not able to support until v9 at the earliest, due to the supported browser versions (Safari v16.4). Ionic Framework supports the feature of form on ion-button to query and submit the closest form, which is a bit different that form control behavior with associating validity state and values.

If you can provide more information about what you are trying to accomplish, we can best evaluate how to offer workarounds or understand if it is resolved by what ElementInternals will offer.

Thanks!

sean-perkins avatar May 07 '24 12:05 sean-perkins

Thanks for the issue! This issue is being closed due to the lack of a reply. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Thank you for using Ionic!

ionitron-bot[bot] avatar May 21 '24 13:05 ionitron-bot[bot]