Skip to content

Submit WebAuthn forms with requestSubmit so Turbo can intercept - #140

Merged
santiagorodriguez96 merged 1 commit into
masterfrom
sr--webauthn-elements--support-turbo-streams
Jun 22, 2026
Merged

Submit WebAuthn forms with requestSubmit so Turbo can intercept#140
santiagorodriguez96 merged 1 commit into
masterfrom
sr--webauthn-elements--support-turbo-streams

Conversation

@santiagorodriguez96

Copy link
Copy Markdown
Collaborator

Motivation

Fixes #138.

Details

  • Replace form.submit() with form.requestSubmit() in both <webauthn-create> and <webauthn-get>. Unlike submit(), requestSubmit() dispatches a cancelable submit event, so Turbo (and any other submit listener) can
    intercept it.
  • Guard against re-entry: since the components listen on the form's submit event, requestSubmit() would re-trigger their own handler. A data-ceremony-completed flag lets the second pass through to the browser/Turbo.

@santiagorodriguez96
santiagorodriguez96 force-pushed the sr--webauthn-elements--support-turbo-streams branch from 85369bb to 211a61d Compare June 19, 2026 18:03
@CamJN

CamJN commented Jun 20, 2026

Copy link
Copy Markdown

Seems to work for me.

@santiagorodriguez96
santiagorodriguez96 merged commit 46c28c2 into master Jun 22, 2026
31 checks passed
@santiagorodriguez96
santiagorodriguez96 deleted the sr--webauthn-elements--support-turbo-streams branch June 22, 2026 18:49
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

Successfully merging this pull request may close these issues.

Form submit event listener incompatible with turbostreams

3 participants