-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Feat: Form attribute of button with type submit #7892
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
base: main
Are you sure you want to change the base?
Feat: Form attribute of button with type submit #7892
Conversation
…b.com/suyash5053/react-spectrum into 1456-form-attribute-for-submit-button
Looks like it is failing Typescript, I don't think you need to worry about form only being allowed on a submit button. For instance, I am pretty sure that 'reset' is also valid to have a form attribute. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for the updated prop, would you be willing to write a test for this? you can add one here https://github.com/adobe/react-spectrum/blob/main/packages/%40react-spectrum/button/test/Button.test.js
I think, I'm missing something since the form id isn't getting passed to the button form prop, which is the reason my test cases are failing, I would take a day to look into this and finalize the test cases, and If I do not find a suitable approach or solution, I will require a bit of help. Thanks for your time. |
@@ -363,5 +363,19 @@ describe('Button', function () { | |||
expect(button).not.toHaveAttribute('href'); | |||
}); | |||
|
|||
it('associates button with form with form id', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like the test is failing, can you see why the form attribute isn't making it onto the button? it's likely being filtered out somewhere
Fixes #1456
Making a draft PR for the maintainers to review the process, if the approach looks good to you, will further work on this
✅ Pull Request Checklist: