Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Dec 4, 2025

This PR attempts to address Issue #9825 by implementing a navigation feature that allows users to quickly jump between their prompts in the chat history.

Summary

Implements the jump-to-prompt navigation feature as outlined in the approved plan. Users can now easily navigate through their conversation history using dedicated navigation buttons or keyboard shortcuts.

Changes

Features Added

  • Navigation Buttons: Added up/down arrow buttons near the scroll-to-bottom button for jumping between user prompts
  • Keyboard Shortcuts: Added Alt+Up/Down keyboard shortcuts for quick navigation
  • Visual Feedback: Added highlight animation when jumping to a prompt for better visual indication
  • Position Indicator: Shows current position (e.g., "2 of 5") when navigating through prompts
  • Smart Navigation: Automatically filters out empty prompts and cycles through available prompts

Technical Implementation

  • Created new UserPromptNavigation component with navigation logic
  • Integrated component into ChatView layout near existing scroll controls
  • Added CSS animations for smooth highlight effects
  • Added comprehensive test coverage for the new feature
  • Added translation keys for internationalization support

User Experience

  • Navigation buttons appear only when there are user prompts to navigate
  • Smooth scrolling animation when jumping to prompts
  • Brief highlight effect on the target message for clear identification
  • Keyboard shortcuts (Alt+Up/Down) for power users
  • Position indicator shows current location in prompt history

Testing

  • ✅ All new component tests passing
  • ✅ All existing tests passing (no regressions)
  • ✅ Linting and type checking pass

Screenshots/Demo

The navigation buttons appear near the scroll-to-bottom button when user prompts are available in the chat history.

Feedback and guidance are welcome!

Closes #9825

- Add UserPromptNavigation component with up/down navigation buttons
- Integrate navigation buttons near scroll-to-bottom button
- Add keyboard shortcuts (Alt+Up/Down) for quick navigation
- Add visual highlight animation when jumping to prompts
- Add position indicator showing current prompt (e.g., "2 of 5")
- Add comprehensive tests for the navigation feature
- Add translation keys for new UI elements

Closes #9825
@roomote
Copy link
Contributor Author

roomote bot commented Dec 4, 2025

Rooviewer Clock   See task on Roo Cloud

Review complete. Found 3 issues that should be addressed:

  • Memory leak risk: Timeout callbacks not cleaned up on component unmount
  • Unclear prop usage: messages prop only used for reset logic, not actual navigation
  • Race condition: Multiple rapid clicks can schedule conflicting timeout callbacks

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

Comment on lines +73 to +87
// Briefly highlight the message after scrolling
setTimeout(() => {
const element = document.querySelector(`[data-message-index="${messageIndex}"]`)
if (element) {
element.classList.add("prompt-highlight")
setTimeout(() => {
element.classList.remove("prompt-highlight")
}, 1500)
}
}, 500)

// Clear navigation state after a delay
setTimeout(() => {
setIsNavigating(false)
}, 3000)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential memory leak: The setTimeout calls for highlighting and clearing navigation state are not cleaned up if the component unmounts. If a user navigates and then quickly switches tasks or closes the view, these timeouts will still fire and attempt to access DOM elements that may no longer exist, potentially causing errors or memory leaks. Consider storing timeout IDs in refs and cleaning them up in a useEffect cleanup function.

Fix it with Roo Code or mention @roomote and request a fix.

Comment on lines +38 to +43
// Reset navigation when messages change significantly
useEffect(() => {
if (!isNavigating) {
setCurrentPromptIndex(-1)
}
}, [messages.length, isNavigating])
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The messages prop is received but only used in a useEffect dependency to reset navigation state. The actual filtering and navigation logic uses visibleMessages. This creates ambiguity about which array is the source of truth. Consider removing the messages prop if it's not needed, or document why both are necessary. If messages.length changes but visibleMessages doesn't (or vice versa), the reset logic might not work as expected.

Fix it with Roo Code or mention @roomote and request a fix.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Dec 4, 2025
Comment on lines +84 to +87
// Clear navigation state after a delay
setTimeout(() => {
setIsNavigating(false)
}, 3000)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Race condition risk: If users click navigation buttons rapidly, multiple setTimeout callbacks will be scheduled to set isNavigating to false after 3 seconds. This could cause the navigation state to be cleared prematurely or behave unpredictably. Consider using a ref to track the timeout ID and clearing it before scheduling a new one, similar to how the highlight timeouts should be managed.

Fix it with Roo Code or mention @roomote and request a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Add button to jump on my last prompt

3 participants