enhancement: Disable Prompt Submission via Enter Key on Mobile Devices #716

Closed
opened 2025-11-11 14:29:40 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @SomaRe on GitHub (Apr 24, 2024).

Is your feature request related to a problem? Please describe.
When using the application on mobile devices or smaller screens, there is no easy way to create a new line within text areas as the Enter key submits the prompt. In contrast, in OpenAI web UI, when window size is smaller enter doesn't submit with enter key..

Describe the solution you'd like
On mobile devices or screens below a certain width (e.g., 768px), the Enter key should not trigger the submission of the prompt.

Describe alternatives you've considered
I have explored alternative solutions, such as utilizing different keyboard options (Google Keyboard and Samsung Keyboard), but none of them provided a suitable workaround for this issue.

Additional context
I primarily use this application hosted on my server as a Progressive Web App (PWA) on my Android smartphone. It is uncertain whether this issue is specific to my device or a more widespread concern.

Here is a potential implementation approach that could be added to the file "src/lib/components/chat/Messages.svelte":

isMobileDevice = false;

// Check if the screen size is small
if (window.innerWidth <= 768) {
  isMobileDevice = true;
}

// ... (existing code) ...

on:keypress={(e) => {
  if (!isMobileDevice) { // Only handle Enter key if not a mobile device
    if (e.keyCode == 13 && !e.shiftKey) {
      e.preventDefault();
    }
    if (prompt !== '' && e.keyCode == 13 && !e.shiftKey) {
      submitPrompt(prompt, user);
    }
  }
}}

I was not confident in the tech stack used here, so I did not request any merge. Feedback on the approach and suggestions welcome.

Originally created by @SomaRe on GitHub (Apr 24, 2024). **Is your feature request related to a problem? Please describe.** When using the application on mobile devices or smaller screens, there is no easy way to create a new line within text areas as the Enter key submits the prompt. In contrast, in OpenAI web UI, when window size is smaller enter doesn't submit with enter key.. **Describe the solution you'd like** On mobile devices or screens below a certain width (e.g., 768px), the Enter key should not trigger the submission of the prompt. **Describe alternatives you've considered** I have explored alternative solutions, such as utilizing different keyboard options (Google Keyboard and Samsung Keyboard), but none of them provided a suitable workaround for this issue. **Additional context** I primarily use this application hosted on my server as a Progressive Web App (PWA) on my Android smartphone. It is uncertain whether this issue is specific to my device or a more widespread concern. Here is a potential implementation approach that could be added to the file "src/lib/components/chat/Messages.svelte": ```javascript isMobileDevice = false; // Check if the screen size is small if (window.innerWidth <= 768) { isMobileDevice = true; } // ... (existing code) ... on:keypress={(e) => { if (!isMobileDevice) { // Only handle Enter key if not a mobile device if (e.keyCode == 13 && !e.shiftKey) { e.preventDefault(); } if (prompt !== '' && e.keyCode == 13 && !e.shiftKey) { submitPrompt(prompt, user); } } }} ``` I was not confident in the tech stack used here, so I did not request any merge. Feedback on the approach and suggestions welcome.
Author
Owner

@tjbck commented on GitHub (Apr 24, 2024):

Great suggestion! I'll take a look!

@tjbck commented on GitHub (Apr 24, 2024): Great suggestion! I'll take a look!
Author
Owner

@SomaRe commented on GitHub (Dec 6, 2024):

So, this issue seems to be back, I do not know which update caused it though, I tested in both iPhone and android (chrome) Enter key submits instead of creating new line.

@SomaRe commented on GitHub (Dec 6, 2024): So, this issue seems to be back, I do not know which update caused it though, I tested in both iPhone and android (chrome) Enter key submits instead of creating new line.
Author
Owner

@rubendax commented on GitHub (Feb 24, 2025):

It would be great to see this as an interface settings option - The ability disable prompt submission via enter key (regardless of device type and window width).

@rubendax commented on GitHub (Feb 24, 2025): It would be great to see this as an interface settings option - The ability disable prompt submission via enter key (regardless of device type and window width).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#716