-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Fix/issue 2189 focus lost alt tab #5838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
MuriloFP
wants to merge
21
commits into
RooCodeInc:main
from
MuriloFP:fix/issue-2189-focus-lost-alt-tab
Closed
Fix/issue 2189 focus lost alt tab #5838
MuriloFP
wants to merge
21
commits into
RooCodeInc:main
from
MuriloFP:fix/issue-2189-focus-lost-alt-tab
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add window focus event listener to ChatView component - Automatically restore focus when window regains focus and conditions are met - Use setTimeout to ensure focus happens after event loop cycle - Add comprehensive tests for focus restoration functionality - Properly clean up event listener on component unmount This fix addresses the issue where users lose focus from the chat text box when switching away from VSCode using Alt+Tab and then switching back.
Member
|
I'm unable to reproduce the issue on main, Would it be good to demonstrate the issue to check if this PR fixes it? |
Contributor
Author
|
Seems the issue was fixed on main somehow... Closing this PR. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
PR - Changes Requested
size:L
This PR changes 100-499 lines, ignoring generated files.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Title: fix: restore focus to chat text box after Alt+Tab (#2189)
Related GitHub Issue
Closes: #2189
Roo Code Task Context (Optional)
N/A
Description
This PR addresses the issue where users lose focus from the Roo Code chat text box when switching away from VSCode using Alt+Tab and then switching back.
Key implementation details:
ChatView.tsxthat triggers when the window regains focus!isHidden && !sendingDisabled && !enableButtonssetTimeoutwith 0ms delay to ensure focus happens after the event loop cycle for better reliability across different platformsDesign choices:
Test Procedure
Unit tests added:
ChatView.spec.tsxto verify window focus event listener setup and cleanupnpx vitest run src/components/chat/__tests__/ChatView.spec.tsxManual testing steps:
Testing environment: Windows 11, VSCode 1.95.0, Roo Code v3.11.3
Additional test scenarios:
Pre-Submission Checklist
Screenshots / Videos
N/A - No UI changes. This is a focus behavior fix that doesn't alter the visual appearance.
Documentation Updates
Additional Notes
This fix specifically addresses the VSCode webview focus loss issue reported by multiple users. The implementation is minimal and follows React best practices for effect handling and focus management.
Get in Touch
@MuriloFP
Important
Adds window focus event listener in
ChatView.tsxto restore focus to chat text box after Alt+Tab, with tests verifying functionality.ChatView.tsxto restore focus to chat text box after Alt+Tab.setTimeoutto ensure focus restoration after event loop cycle.ChatView.spec.tsxto verify window focus event listener setup and cleanup.npx vitest run src/components/chat/__tests__/ChatView.spec.tsx.This description was created by
for e63ed48. You can customize this summary. It will automatically update as commits are pushed.