-
Notifications
You must be signed in to change notification settings - Fork 268
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
Chat: Fix input focus issue #3147
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this could be a good quick fix (though from an interaction POV I'd prefer it if we only changed keyboard focus if "Edit Message" had focus, which means the user didn't move and continue doing other things… even within the same webview).
This fix does seem to have this bug now though:
CleanShot.2024-02-13.at.12.46.51.mp4
ah i forgot to remove the uEffect dependence. I think the latest commit should work now, but will test it more thoroughly tomorrow to confirm |
I gave this a quick test, but doesn't seem to work: CleanShot.2024-02-14.at.10.55.13.mp4 |
That helps! See the latest update: Screen.Recording.2024-02-13.at.4.15.51.PM.movDo you know if we can use e2e test for this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to work great now!
There's still one improvement that I would have loved us do, which is to only_refocus the message input if "Edit Last Message" has focus. If the user is doing other things in the webview we shouldn't interrupt them (like it does below):
CleanShot.2024-02-14.at.13.05.50.mp4
Not really sure! Is there a way to pause or slow down the LLM response in the e2e test perhaps? 🤔 @dominiccooney has done a lot of e2e work, and may have ideas? (e.g. how to test doing an edit, moving the focus during the stream, and then verifying an expectation… all before the stream completes) |
Yes, that sounds useful. You'll need to hack on vscode/test/fixtures/mock-server.ts and change the One cheesy but effective technique is to put "instructions" to the server in the request. For example you could send it some JavaScript in some marker tags in the chat, and then Second idea is to actually have the mock server turn around and use/hand out Promises so you can precisely stage when things happen. You can look at how the mock graphql server is set up and used for some ideas. Or you could do some combination of these two. |
Makes sense! Do you mind filing an issue so i can look into that after i'm done with my current issue? |
CONTEXT: https://sourcegraph.slack.com/archives/C05AGQYD528/p1707784216516929
Fix an issue with editor focus being stolen by webview when webview is not focused.
This change updates the Chat.tsx component to pass the isWebviewActive prop to the inputCaretPosition and isFocusd props, which are used for setting the focus to the chat input box, respectively.
This PR updated to not set chat input focus when isWebviewActive is not true, meaning the editor is currently focused.
Test plan
All bots are green.
Screen.Recording.2024-02-12.at.4.50.39.PM.mov