Add page number input to chat log pagination#112
Conversation
Co-authored-by: frasermolyneux <34033625+frasermolyneux@users.noreply.github.com>
Co-authored-by: frasermolyneux <34033625+frasermolyneux@users.noreply.github.com>
Co-authored-by: frasermolyneux <34033625+frasermolyneux@users.noreply.github.com>
Co-authored-by: frasermolyneux <34033625+frasermolyneux@users.noreply.github.com>
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
| jumpContainer.innerHTML = ` | ||
| <span class="page-jump-label">Go to page:</span> | ||
| <input type="number" id="pageJumpInput" class="page-jump-input" min="1" max="${totalPages}" value="${pageInfo.page + 1}" /> | ||
| <span class="page-jump-total">of ${totalPages}</span> | ||
| `; |
Check warning
Code scanning / ESLint
Assignments to [innerHTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML)/[outerHTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML) properties or calls to [insertAdjacentHTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML) method manipulate DOM directly without any sanitization and should be avoided. Use document.createElement() or similar methods instead. Warning
There was a problem hiding this comment.
Pull request overview
Adds a direct “go to page” control to the Chat Log DataTables pagination UI to let users jump to a specific page number (global/game/server chat log pages), alongside responsive styling.
Changes:
- Injects a page-number input UI before the DataTables pagination controls and wires it to DataTables paging (
addPageJump()). - Keeps the input’s current page / total pages in sync via the
draw.dtevent. - Adds SCSS styles for the new page-jump control, including mobile-friendly layout.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/XtremeIdiots.Portal.Web/wwwroot/js/chatlog-index.js | Adds addPageJump() and hooks it into DataTables init/redraw to enable direct page navigation. |
| src/XtremeIdiots.Portal.Web/Styles/features/_chatlog.scss | Styles the new .datatable-page-jump control and makes it responsive. |
| pageInput.addEventListener('keypress', function(e) { | ||
| if (e.key === 'Enter') { |
There was a problem hiding this comment.
keypress is deprecated and can behave inconsistently across browsers for non-printing keys like Enter. Prefer keydown/keyup (and optionally e.preventDefault() on Enter) for more reliable handling.
| pageInput.addEventListener('keypress', function(e) { | |
| if (e.key === 'Enter') { | |
| pageInput.addEventListener('keydown', function(e) { | |
| if (e.key === 'Enter') { | |
| e.preventDefault(); |
| pageInput.value = pageInfo.page + 1; | ||
| pageInput.max = pageInfo.pages; | ||
|
|
||
| const totalSpan = document.querySelector('.page-jump-total'); |
There was a problem hiding this comment.
In the draw.dt handler, document.querySelector('.page-jump-total') searches the whole document. It would be more robust to scope this lookup to the page-jump container (or otherwise keep a reference) to avoid accidentally updating the wrong element if another .page-jump-total exists on the page.
| const totalSpan = document.querySelector('.page-jump-total'); | |
| const totalSpan = jumpContainer.querySelector('.page-jump-total'); |
| <span class="page-jump-label">Go to page:</span> | ||
| <input type="number" id="pageJumpInput" class="page-jump-input" min="1" max="${totalPages}" value="${pageInfo.page + 1}" /> | ||
| <span class="page-jump-total">of ${totalPages}</span> |
There was a problem hiding this comment.
The page-jump input doesn’t have an associated label (a isn’t announced as a label by many screen readers). Consider using a … or adding an aria-label/aria-labelledby/aria-describedby so the control is accessible.
| <span class="page-jump-label">Go to page:</span> | |
| <input type="number" id="pageJumpInput" class="page-jump-input" min="1" max="${totalPages}" value="${pageInfo.page + 1}" /> | |
| <span class="page-jump-total">of ${totalPages}</span> | |
| <label for="pageJumpInput" class="page-jump-label">Go to page:</label> | |
| <input type="number" id="pageJumpInput" class="page-jump-input" min="1" max="${totalPages}" value="${pageInfo.page + 1}" aria-describedby="pageJumpTotal" /> | |
| <span id="pageJumpTotal" class="page-jump-total">of ${totalPages}</span> |
🏗️ Terraform Plan
✅ Validate — Passed ✅ Plan
|
|



Users need direct page navigation on chat log pages rather than clicking through sequentially.
Changes
JavaScript (
chatlog-index.js)addPageJump()function that injects page number input before pagination controlsdraw.dtevent to update max pages and current value dynamicallyparseInt(value, 10)andisNaN()check for reliable validationCSS (
_chatlog.scss).datatable-page-jumpstyles using existing design tokensBehavior
Applies to global, game-specific, and server-specific chat log pages.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.