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

Form.Field - Cannot set ID when contains child elements or content prop #3900

Closed
srotbart opened this issue Feb 22, 2020 · 3 comments · Fixed by #3901
Closed

Form.Field - Cannot set ID when contains child elements or content prop #3900

srotbart opened this issue Feb 22, 2020 · 3 comments · Fixed by #3901
Labels

Comments

@srotbart
Copy link
Contributor

srotbart commented Feb 22, 2020

Bug Report

When creating a <Form.Field> with child elements or content prop, ID is ignored and cannot be set on the div that is created from the <Form.Field>.

This bug is caused by the following PR: #3822
Since the PR added id prop as one of the handled props for this component if it is provided by the user it will be filtered out on the getUnhandledProps function.

When no control is provided the created element props will be taken from the rest variable.
Because the id was filtered out from the rest variable it will not be passed to the child elements or the content that was set.

Let me know if you agree that this is a bug and I can open a PR for the fix and review

Steps

Create a form and add <Form.Field>:

<Form>
    <Form.Field id="testId" content="Some content"/>
 </Form>

Expected Result

<form class="ui form">
    <div id="testId" class="field">Some content</div>
</form>

Actual Result

<form class="ui form">
    <div class="field">Some content</div>
</form>

Version

0.88.2

Testcase

https://codesandbox.io/s/semantic-ui-react-9gnsc

@welcome
Copy link

welcome bot commented Feb 22, 2020

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you've completed all the fields in the issue template so we can best help.

We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@srotbart srotbart changed the title Form.Field - When "control Form.Field - Cannot set ID when contains child elements Feb 22, 2020
@srotbart srotbart changed the title Form.Field - Cannot set ID when contains child elements Form.Field - Cannot set ID when contains child elements or content prop Feb 22, 2020
@mattberg88
Copy link

Hi, I seemed to have found the solution, may I work on this issue?

@srotbart
Copy link
Contributor Author

@mattberg88 I've opened PR #3901 for the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants