Streaming live at 10am (PST)

A script I added for accessibility purposes seems to be blocking form submission

I’ve been implementing the following script in footer code so as to appropriately set focus when skip links are used, or in this particular case, when a success or error message replaces a contact form on my site.

The script is working everywhere but the form, and working on the form in terms of modifying the tabindex, but for reasons I haven’t been able to figure out it’s also preventing the form from actually being submitted.

I might be able to work around this by redirecting to a new page upon submission and setting focus there, but any ideas as to what’s going on with this or what to try would be very much appreciated.

<script>
  document.getElementById('submit').addEventListener('click', function(e) {
    e.preventDefault();
    var target = document.getElementById('wf-form-Get-in-touch-form');
    target.setAttribute('tabindex', '-1');
    target.focus();
  });
</script>

Here is the page: https://www.milesreiter.com/get-in-touch