Skip to content
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

Keyboard shortcuts: fix warnings and add one for focusing chat input #139

Open
ellisonbg opened this issue Dec 30, 2024 · 3 comments
Open
Labels
bug Something isn't working

Comments

@ellisonbg
Copy link
Collaborator

A few minor issues with keyboard shortcuts with Jupyter AI 3.0.0a0 pre-release.

Description

First, I see the following warnings in the browser console when using Jupyter AI 3.0.0a0 pre-release:

Screenshot 2024-12-30 at 10 18 34 AM

Second, when I have a chat document open and active, pressing enter doesn't focus the text box like I would expect.

Reproduce

  1. Open chat document.
  2. Make sure the text box is blurred, while the document is active.
  3. Press enter to focus the text box.
  4. See that it doesn't get focus (mouse click is required).

Expected behavior

  • As a user, I want to use enter to focus the text box of a chat document.
@ellisonbg ellisonbg added the bug Something isn't working label Dec 30, 2024
@dlqqq dlqqq changed the title Ketboard shortcut behavior in 3.0.0a0 pre-release Keyboard shortcuts: fix warnings and add one for focusing chat input Dec 30, 2024
@dlqqq dlqqq transferred this issue from jupyterlab/jupyter-ai Dec 30, 2024
@brichet
Copy link
Collaborator

brichet commented Jan 6, 2025

Thanks for opening this.
I opened jupyterlab/jupyter-ai#1186 in jupyter-ai to fix the warning and the shortcut.

About the second issue, on my side I can type in the input box without pressing enter or using the mouse. Focusing it with the tabulation is enough to be able to type in it. Do you think that it should be handled differently ?

@dlqqq
Copy link
Member

dlqqq commented Jan 7, 2025

@brichet Thanks for opening that PR, I've merged it. Doesn't Ctrl + Shift + 1 focus the chat input like it did in Jupyter AI v2?

For reference, this is the shortcut being removed. If this was duplicated by Jupyter Chat, then it seems to imply that Ctrl + Shift + 1 also focuses the chat input.

  "jupyter.lab.shortcuts": [
    {
      "command": "jupyter-ai:focus-chat-input",
      "keys": ["Accel Shift 1"],
      "selector": "body",
      "preventDefault": false
    }
  ],

@brichet
Copy link
Collaborator

brichet commented Jan 7, 2025

Indeed, this shortcut was duplicated in jupyter-chat, this is why there were the warnings when using with jupyter-ai.

In jupyter-chat, this is a little trickier, as there may be several open chats, so we use a WidgetTracker to focus on the current (last-used) chat. But that tracker only tracks the main area chats (#130), so the chats in the side panel can't be focused (neither to be restored, btw).

I opened #146 to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants