Replies: 2 comments
-
|
The current debounce logic triggers a page jump if the user pauses while typing, which leads to premature navigation (for example, jumping to page 1 when the user intends to type 10). This happens because the debounced handler is called on every input change after a 500ms pause, not just when the user confirms their input. A better approach is to trigger the page change only when the user presses Enter or the input loses focus (blur). To do this, remove the debounce logic from the input change handler and instead call your page change logic in the input's Here’s a simplified example of how you could refactor the input handling in React/TypeScript: <Input
value={inputValue}
onChange={handleInputChange}
onBlur={handleConfirm}
onKeyDown={e => {
if (e.key === 'Enter') handleConfirm();
}}
/>Where To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
|
resolved #26481 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Self Checks
Content
As long as the user pauses for more than 500 milliseconds (set by
wait) during input, the page number update will be triggered.For example, if a user wants to input "10" but pauses for more than 500 milliseconds after typing "1", the page will first jump to page 1.
We should perform the jump only when the user clearly indicates that the input is complete.
This is usually achieved in the following two ways:
Beta Was this translation helpful? Give feedback.
All reactions