Skip to content

fix: prevent pagination buttons from submitting forms - #1513

Open
sridharkalaibala wants to merge 1 commit into
grid-js:masterfrom
sridharkalaibala:fix/pagination-button-type
Open

sridharkalaibala wants to merge 1 commit into
grid-js:masterfrom
sridharkalaibala:fix/pagination-button-type

Conversation

@sridharkalaibala

Copy link
Copy Markdown

Problem

Pagination buttons default to submitting their surrounding form. A grid embedded in a form can change page and then immediately submit/reload the page, including when an ellipsis is clicked.

Change

Set type="button" on every pagination button: previous/next, page numbers, first/last shortcuts, and both ellipses. No event suppression or changes to page-selection logic are needed.

Fixes #1248. The earlier #1268 was closed without merging; the issue remains on current master.

Validation

  • Added three regressions that mount pagination in a real jsdom form at the first, middle, and last page and use native DOM .click(). All three fail before the fix because submit events fire, and pass afterward.
  • The tests also verify that previous/next clicks still produce the expected page data.
  • Full Jest suite: 195 tests and 36 snapshots pass across 34 suites.
  • Snapshot changes were checked against upstream: only type="button" attributes were added.
  • Changed-file ESLint, Prettier, and git diff --check pass.
  • Browser E2E and the complete bundle build were not run. No dependency or lockfile changes.

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.

pagination buttons will trigger form post

1 participant