Skip to content

fix(LoadingButton): allow submit buttons to submit their form#600

Merged
mrholek merged 1 commit into
mainfrom
fix/loading-button-submit
Jul 13, 2026
Merged

fix(LoadingButton): allow submit buttons to submit their form#600
mrholek merged 1 commit into
mainfrom
fix/loading-button-submit

Conversation

@mrholek

@mrholek mrholek commented Jul 13, 2026

Copy link
Copy Markdown
Member

The data-api click handler for `data-coreui-toggle="loading-button"` called `event.preventDefault()`, so a `` inside a `` never submitted the form. Adding the loading state should not suppress the button's default action.

Fix

Remove the `event.preventDefault()` from the data-api handler. The loading state still starts on click; the default action (form submit, etc.) now runs as expected.

Tests

  • `data-api` › should not prevent default behavior on click (replaces the previous test that asserted the opposite)
  • `data-api` › should not prevent a submit button from submitting its form

Parity

Vanilla-only bug — it lives in the `data-coreui-toggle` auto-init handler. The React/Vue/Angular `CLoadingButton` components do not call `preventDefault` (they just invoke the user's `onClick`), so submit works there already. No cross-framework port needed.

Closes #546. Original fix by @vladrusu.

The data-api click handler called event.preventDefault(), which stopped a
button[type=submit] with data-coreui-toggle="loading-button" from submitting
its form. Drop the preventDefault so the default action runs while the loading
state still starts.
@mrholek mrholek merged commit a4c7bbe into main Jul 13, 2026
6 of 7 checks passed
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 29294566657

Coverage decreased (-0.02%) to 94.635%

Details

  • Coverage decreased (-0.02%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 1 coverage regression across 1 file.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
js/src/navigation.js 1 64.19%

Coverage Stats

Coverage Status
Relevant Lines: 7462
Covered Lines: 7186
Line Coverage: 96.3%
Relevant Branches: 3088
Covered Branches: 2798
Branch Coverage: 90.61%
Branches in Coverage %: Yes
Coverage Strength: 794.16 hits per line

💛 - Coveralls

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.

2 participants