uswds icon indicating copy to clipboard operation
uswds copied to clipboard

USWDS - Bug: Modals break DOM

Open hobbez opened this issue 3 years ago • 0 comments

Describe the bug

If a modal is coded within a form tag, fields in the modal will not be included when the form is submitted and an input type="submit" button will not work because the modal is rebuilt at the end of the DOM extracting it from the form. It is possible to workaround using JavaScript, however a simple confirm type modal for a form should not require it.

Steps to reproduce the bug

  1. Code a form containing a modal that includes an input type="submit" button
  2. Cause the modal to open
  3. Click the submit button This results in the form not being submitted.

Expected Behavior

The content of the modal should remain within the original DOM structure. For the

example, fields in the modal should continue to "exist" within the form.

Related code

`

. . . . . .
`

Screenshots

No response

System setup

  • USWDS version: 3.0.0

Additional context

[https://gsa-tts.slack.com/archives/C3F14AHSQ/p1660061984483449](Slack thread)

Code of Conduct

hobbez avatar Aug 09 '22 21:08 hobbez