Skip to content

fix: clicking submit after tabbing out of the form submits again (6.4.x) - #288

Closed
RensTillmann wants to merge 1 commit into
release/6.4.xfrom
fix/64-tab-then-click-submit
Closed

RensTillmann wants to merge 1 commit into
release/6.4.xfrom
fix/64-tab-then-click-submit

Conversation

@RensTillmann

@RensTillmann RensTillmann commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

Old bug, found by the release gate and reproduced on released 6.4.009 with a plain submit button: fill a field, press Tab until focus leaves the form, then click the submit button: nothing is submitted.

Cause: after a Tab, SUPER.lastTabKey stays tab until the next keydown. A mouse press on the button first focuses the FORM element; the focusin handler treats that as tabbing into the form, focuses the first field and the page scrolls, so the mouseup lands elsewhere and the click is lost.

Fix: a capturing mousedown / touchstart listener resets SUPER.lastTabKey before focus moves, so a pointer press is never treated as Tab-in. Keyboard Tab and Shift+Tab navigation is unchanged (lastTabKey is still set by the keydown handler).

Base branch

release/6.4.x: bug fix.

Tests

tests/test-tab-then-click-client.cjs (real focusin handler + new listener from elements.js in a sandbox):
  without the fix: fails at "mousedown resets lastTabKey"
  with the fix:    4/4 (Tab and Shift+Tab into the form still focus the first/last field; mousedown and touchstart do not)
all client tests pass

Browser regression (tab-then-click.spec.ts in the local runner): tab completely outside a form taller than the viewport, then click Send. Released 6.4.009: no submission request within 30 seconds; cand3: passes all 3 repetitions, exactly one request and one saved entry. Shift+Tab navigation passes on both builds.

Final cand3 gate 20261020-164106-06bd8f: gate 10/10, security 15/15, full 37 passed / 5 mapped skips, CVE pass. These are local --zip candidate results, not formal release acceptance.

Merge

Draft: for QA and the next release session.

@RensTillmann

Copy link
Copy Markdown
Owner Author

The fix is already released in 6.4.010 (release PR #299, merged 21 Oct 2026): src/assets/js/frontend/elements.js lines 1479-1483 clear the last Tab key on mousedown/touchstart, the same code as this PR. This PR's test file tests/test-tab-then-click-client.cjs was not part of that release and stays on this branch. The browser suite covers this on 6.4.010 (tab-then-click.spec.ts, 2 tests passed).

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.

1 participant