[x] I’ve searched for any related issues and avoided creating a duplicate issue.
What happened
I noticed that va-search-input is firing the onSubmit function twice when the keyboard is used to submit the form (pressing "Enter"). In the video, you can see the /forms API call is made once when clicking to submit, and the second time it's submitted by hitting "Enter" and the API call is made twice. I think this is because the keyboard press event on the component is not using event.preventDefault(). I'm working on converting to this web component for the global search locally and noticing the same behavior.
Bug Report
What happened
I noticed that
va-search-input
is firing theonSubmit
function twice when the keyboard is used to submit the form (pressing "Enter"). In the video, you can see the/forms
API call is made once when clicking to submit, and the second time it's submitted by hitting "Enter" and the API call is made twice. I think this is because the keyboard press event on the component is not using event.preventDefault(). I'm working on converting to this web component for the global search locally and noticing the same behavior.https://github.com/user-attachments/assets/69d283fd-89c9-44de-86df-a2118274b0e8
What I expected to happen
onSubmit
function should only fire one time regardless of how the search is submitted.Reproducing
Prod example: https://www.va.gov/find-forms (and here's the code where that VaSearchInput is implemented)
Steps to reproduce:
/forms
API is called twice when "Enter" is pressedUrgency
How urgent is this request? Please select the appropriate option below and/or provide details
Details
Since this is a production bug, would it be possible to prioritize this soon? It is also blocking a couple of tickets I have in our current sprint.