Skip to content
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

feat: support setting form ID on form components #6682

Merged

Conversation

jcfranco
Copy link
Member

Related Issue: #5164

Summary

This allows developers to associate form components by providing the form ID.

Notes

  • the form must be available in the DOM before the component is attached to the DOM
  • components will not look up ancestors for form if the ID is invalid or if the form is not found

Follow-up

I'll DRY up some duplication in the commonTests#formAssociated test helper in a separate PR. I went this route to expedite testing.

@jcfranco jcfranco requested a review from a team as a code owner March 28, 2023 00:38
@github-actions github-actions bot added the enhancement Issues tied to a new feature or request. label Mar 28, 2023
Copy link
Member

@benelan benelan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple comments, otherwise LGTM with the commonTest stuff being hung up to DRY in a follow up PR

@@ -75,6 +74,14 @@ export class Button
/** When `true`, interaction is prevented and the component is displayed with lower opacity. */
@Prop({ reflect: true }) disabled = false;

/**
* The ID of the form owner to associate this component with.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "The ID of the form owner to associate with the component"? IIRC ending a sentence with "with" is frowned upon by the dictionary dwellers. Applies to the other components as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great suggestion with!

src/components/button/button.tsx Outdated Show resolved Hide resolved
src/utils/form.spec.ts Outdated Show resolved Hide resolved
@jcfranco jcfranco merged commit 1a4041d into master Mar 28, 2023
@jcfranco jcfranco deleted the jcfranco/5164-support-setting-form-ID-for-form-components branch March 28, 2023 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issues tied to a new feature or request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants