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

Opening accordion triggers form submission #154

Closed
thekatze opened this issue May 20, 2022 · 2 comments
Closed

Opening accordion triggers form submission #154

thekatze opened this issue May 20, 2022 · 2 comments

Comments

@thekatze
Copy link

Describe the bug
Clicking the accordion header to expand the accordion submits a form

Code to Reproduce

<form onSubmit={() => window.alert("Form submitted")}>
  <Accordion>
    <AccordionItem>
      <AccordionButton>
        <Text flex={1} fontWeight="$medium" textAlign="start">
          Accordion Header
        </Text>
        <AccordionIcon />
      </AccordionButton>
      <AccordionPanel>
        Accordion Content
      </AccordionPanel>
    </AccordionItem>
  </Accordion>
</form>

Expected behavior
I can open the accordion without submitting the enclosed form

Workaround/Solution
Add the type="button" property to AccordionButton

@fabien-ml
Copy link
Collaborator

fabien-ml commented May 20, 2022

Hi, thanks for submitting the bug report. As a temporary workaround you can manually add the type="button" prop on the AccordionButton until I publish a new version with the fix.

fabien-ml pushed a commit that referenced this issue May 20, 2022
@fabien-ml
Copy link
Collaborator

fixed in v0.6.1.

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

No branches or pull requests

2 participants