[kumo] add pagination Enter key navigation and dropdown page selector#342
Conversation
- Fix page number input to call setPage() on Enter key press (previously
only triggered on blur), with clamping to [1, maxPage]
- Add pageSelector prop to Pagination.Controls ('input' | 'dropdown'),
defaulting to 'input' for backward compatibility
- When pageSelector='dropdown', render a Select with all page numbers
instead of the text input
- Add comprehensive test suite (20 tests) covering navigation buttons,
Enter key handling, dropdown mode, and backward compatibility
The Select dropdown in the InputGroup had its default rounded corners, breaking visual alignment with the adjacent flat-edged navigation buttons. Add rounded-none to match the InputGroup.Input behavior.
The Select trigger uses ring-kumo-ring (from buttonVariants secondary) while InputGroup.Button uses ring-kumo-line. Override to ring-kumo-line so the dropdown border matches the adjacent navigation buttons.
Keep upstream's restructured docs format and add our dropdown page selector section in the same style.
|
/bonk please review |
|
UnknownError: ProviderInitError |
|
@stritt Bonk workflow failed. Check the logs for details. View workflow run · To retry, trigger Bonk again. |
commit: |
Docs PreviewCommit: |
|
/bonk-check |
|
/bonk review |
|
/bonk |
|
/bonk this looks good to me, but what say you? |
There was a problem hiding this comment.
Thanks for this PR! The Enter key navigation and dropdown page selector are useful additions. The code is well-structured and the test coverage is comprehensive.
Summary
Changes:
- ✅ Enter key now triggers page navigation (with clamping)
- ✅ New
pageSelectorprop for dropdown mode - ✅ 20 comprehensive tests covering all scenarios
- ✅
clamputility extracted as suggested - ✅ Backward compatibility maintained
Concerns
1. Dropdown performance with large page counts (line 243)
When maxPage is very large (e.g., 10,000+ pages), rendering all options in the dropdown will cause performance issues. Consider:
- Adding a threshold above which the input mode is forced
- Or documenting this limitation in the prop JSDoc
2. Missing test for dropdown page selection (lines 186-205)
The dropdown tests verify rendering but don't test that selecting a page actually calls setPage. Consider adding:
it('calls setPage when selecting a page from dropdown', async () => {
const user = userEvent.setup();
const setPage = vi.fn();
renderPagination({ pageSelector: 'dropdown', setPage });
const combobox = screen.getByRole('combobox', { name: 'Page number' });
await user.click(combobox);
// Select option 5...
});3. Select width in dropdown mode (line 233-248)
The Select component may need explicit width styling to match the input's 50px width, or the layout may shift. Have you verified this renders consistently?
Minor
The changeset and documentation updates are appreciated. The visual regression failures appear to be unrelated noise (Button, Dialog, Select).
Overall this is a solid PR. Addressing the performance concern and adding the missing interaction test would make it complete.
|
I've submitted a comprehensive review for PR #342. Here's a summary of my findings: ✅ What's Good
|





































































Summary
<Input>inPagination.Controlspreviously only calledsetPage()on blur. Now pressing Enter also navigates to the typed page, with clamping to[1, maxPage].pageSelectorprop: NewpageSelectorprop onPagination.Controls("input" | "dropdown", defaults to"input"). When set to"dropdown", renders a<Select>with all page numbers instead of the text input.Changes
packages/kumo/src/components/pagination/pagination.tsxonKeyDownhandler for Enter key; addedpageSelectorprop with dropdown rendering; extractedclamputility; documented dropdown performance note in JSDocpackages/kumo/src/components/pagination/pagination.test.tsxHow to test
Backward compatibility
All defaults are unchanged —
pageSelectordefaults to"input"andcontrolsdefaults to"full". Existing usage is unaffected.Demo of the dropdown page selection
New docs section screenshot
Checklist