Skip to content

Fix listing pagination clicks updating the list twice - #15217

Merged
cderv merged 2 commits into
mainfrom
fix/listing-pagination-double-update
Oct 28, 2026
Merged

cderv merged 2 commits into
mainfrom
fix/listing-pagination-double-update

Conversation

@cderv

@cderv cderv commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Clicking a page link in a website listing ran list.update() twice, so every list.on("updated") handler ran twice per click. Nothing changes on screen, as showing the same page twice gives the same result. Found while working on #15214.

Root cause

Quarto sets an onclick on each page link that writes the page into the URL hash and calls showPage(). Returning false only cancels the link navigation. The click still bubbles to the listener that the list.js pagination plugin binds on the pagination list, and that listener shows the same page again.

This list.js listener was already in the vendored list.min.js when the onclick was added in e6111a3 to write the page into the URL. The showPage() call duplicated list.js from the start.

Fix

The onclick now only records the page hash, and list.js shows the page.

Tests

listing-update-handlers.spec.ts gets a case that clicks page 2 of each listing and counts handler runs: 2 before the fix, 1 after. listing-interactions.spec.ts checks the page hash and back navigation after a pagination click, and it passes unchanged.

Checklist

I have (if applicable):

  • referenced the GitHub issue this PR closes
  • updated the appropriate changelog in the PR
  • ensured the present test suite passes
  • added new tests
  • created a separate documentation PR in Quarto's website repo and linked it to this PR
AI-assisted PR
  • AI tool used: Claude Code
  • Codebase grounding: local clone
  • Human review: I have reviewed, tested, and verified the AI-generated content before submitting.

Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.

Quarto's onclick on each page link set the page hash and also called
showPage(). Returning false from an onclick property only cancels the
link's default navigation; the click still bubbles to the listener that
list.js's pagination plugin binds on the pagination list, which shows the
same page again. Every click therefore ran list.update() and all
"updated" handlers twice. show() is idempotent, so nothing visibly broke,
but each handler did its work twice per click.

list.js already shows the clicked page, so the onclick now only records
the page hash. The new Playwright case counts update-handler runs for one
pagination click (2 before, 1 after) in each browser.
@posit-snyk-bot

posit-snyk-bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cderv
cderv merged commit cd95d21 into main Oct 28, 2026
51 of 52 checks passed
@cderv
cderv deleted the fix/listing-pagination-double-update branch October 28, 2026 13:18
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