Skip to content

Conversation

edward-ly
Copy link
Contributor

@edward-ly edward-ly commented Apr 16, 2025

Resolves #210. This enables the Ctrl+Enter shortcut to submit a prompt in the text input field to the AI.

Copy link
Member

@julien-nc julien-nc left a comment

Choose a reason for hiding this comment

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

Works like a charm. Now we need to let the user know that CTRL+enter can be used to submit the form in text fields. @jancborchardt @nimishavijay Any suggestion on where to mention that?
For context, here is the view we are talking about:
image

@edward-ly edward-ly force-pushed the feat/submit-on-enter branch from bc81a20 to 922d9f8 Compare April 22, 2025 18:07
@nimishavijay
Copy link
Member

Well, my first question was to ask what was answered in the issue -- why are we not using enter? Seems like the most obvious key here, especially since it is used in the chat too. If it is possible to override the component restrictions on using enter then I'd go for that, otherwise what do you think of right next to the send button? It can be hidden on mobile since ctrl is not a thing there anyway. Something like this:

image

Also keep in mind for macOS it would be Cmd+Enter

@edward-ly
Copy link
Contributor Author

My initial thought was that for some tasks such as summarize, the prompt is expected to be a multi-line article, so it would make more sense to use Enter to create a new line rather than submit the prompt (which is the case for text boxes with the multiline attribute). But now, I think that most people would copy/paste the longer text from elsewhere instead, and so having Enter submit the prompt for all tasks might be better for consistency. @julien-nc what do you think?

@julien-nc
Copy link
Member

I have no strong opinion.
If we go with "enter" to validate the form then it must be mentioned very explicitly that a new line can be obtained with "shift+enter".

Copy link
Member

@jancborchardt jancborchardt left a comment

Choose a reason for hiding this comment

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

As @nimishavijay said (and was originally specified?), we need to go for Enter as submit key here:

  • It’s a well-known submit key, especially for a single-line input we have here
  • Brief test with ChatGPT and Mistral: Enter submits, Shift-Enter newline, so people are used to this. (They don’t even have hints for how to do newlines there)

@jancborchardt jancborchardt moved this to 🏗️ At engineering in 🖍 Design team Apr 28, 2025
@edward-ly
Copy link
Contributor Author

@jancborchardt Done in 02a5fce, unless you wanted to also provide a hint to the user that Shift+Enter adds a new line?

@janepie
Copy link
Member

janepie commented Apr 29, 2025

I'm voting to have the hint and would put it under the input field.

Works good! Does this translate to mobile, so does this mean there is no way to have a new line on mobile? I have no mobile setup to test it unfortunately

@edward-ly
Copy link
Contributor Author

edward-ly commented Apr 29, 2025

I'm voting to have the hint and would put it under the input field.

@jancborchardt @nimishavijay What do you think about this? I think having the hint next to the box it's used on makes sense too, but it might result in duplicate hints if there is more than one input text field (e.g. context write, perhaps).

Works good! Does this translate to mobile, so does this mean there is no way to have a new line on mobile? I have no mobile setup to test it unfortunately

I tried it on the daily instance with the chat task and the Enter key on mobile does indeed submit the task too. Maybe we should make the multiline attribute more responsive to the screen size?

@edward-ly edward-ly force-pushed the feat/submit-on-enter branch from 02a5fce to 828d0e6 Compare April 30, 2025 18:58
@edward-ly
Copy link
Contributor Author

edward-ly commented Apr 30, 2025

I copied the isMobile mixin from the dashboard app and made the multiline attribute dependent on that value, so it should work again in theory now, but I don't have a dev setup yet for mobile either.

@DaphneMuller
Copy link

I'm not sure why we are discussing about mobile. I don't require mobile to function for this change to be merged.

@janepie
Copy link
Member

janepie commented May 5, 2025

I would prefer to not break the possibility of adding multiline text into the task type on mobile devices (in a browser, not talking about clients here).
I tested with the Device function of Chromium and it looks good, no submit-on-enter on mobile :)

edward-ly added 3 commits May 5, 2025 09:52
This enables the Ctrl+Enter shortcut to submit a prompt in the text input field to the AI.

Signed-off-by: Edward Ly <contact@edward.ly>
Signed-off-by: Edward Ly <contact@edward.ly>
Signed-off-by: Edward Ly <contact@edward.ly>
@edward-ly edward-ly force-pushed the feat/submit-on-enter branch from 828d0e6 to 966823c Compare May 5, 2025 16:52
@edward-ly edward-ly merged commit 6248962 into main May 5, 2025
9 checks passed
@edward-ly edward-ly deleted the feat/submit-on-enter branch May 5, 2025 16:58
@github-project-automation github-project-automation bot moved this from 🏗️ At engineering to 🎉 Done in 🖍 Design team May 5, 2025
@julien-nc julien-nc mentioned this pull request Jun 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🎉 Done
Development

Successfully merging this pull request may close these issues.

Press enter to validate input forms
6 participants