Pressing enter no longer submits

The solution does not require any plugins or other methods. In my Windows 10 system, in windowed mode, pressing the following four keys sequentially: ‘fn’ + ‘win’ + ‘alt’ + ‘enter’ can solve this problem. Interestingly, it needs to be done every time.

Junst foundout taht ‘win+alt+enter’ works as send.

3 Likes

actually you don’t need that alt, only windows+enter works fine

This is the best solution by far

2 Likes

this is a good script but it seems doesnt work anymore.

Guys after working on finding a solution for long time online, I found it out myself that Tab+Enter sends the prompt and thus solves the issue.

Shift+Enter takes you to next line while Ctrl+Enter does nothing.

2 Likes

you can use Tab+Enter instead which makes it more easier…
Just found it myself

2 Likes

Here is all the information I am able to gather so far…

  1. Pressing enter submits the prompts if you are on full screen and won’t work if you are using your GPT window in a small size.
  2. Some people are saying cmd /ctrl+ Enter works but it didn’t work for me.
  3. There is one more solution you can decrease you screen resolution by pressing cmd/ctrl + - until you can see the tab containing old chats then enter key will work fine.
1 Like

I recently found one solution for this, But you would need your chat gpt tab to be selected for this solution. Just press tab and enter to feed your prompt to gpt!

1 Like

OMG. Workflow saver!! Pressing a few single keys always is faster for me than pressing a key combination. More importantly, less prone to fat fingering for me. This is an old post but newly discovered for me and the BEST solution for me!! Thank you!!

i had the same, removing highlighted element resolved it for me, so i’m now always prompting with inspectElements open…

On Ubuntu 20.04, I use Window+Enter and it works !

1 Like

Usually I double-tap Enter quickly and it works! : )

1 Like

Above, the AI of ChatGPT is just beeing agreeable and not really answering about things it knows. It can say other things, agreeing with mistruths:


However, you do have an interesting discovery with absolutely no hint that it should work that way: in a narrow viewport where enter key is blocked from sending (which seems like backwards logic - it is the wide desktop user who likely composes complex inputs), pounding enter twice quickly does send the message!

In a wide view, one must actually use shift-enter in order to suppress an unwanted send when adding lines.

This script worked for me. I modified Chris20’s script so that only pressing enter will send the prompt. Shift or Alt + Enter will not send the prompt.

For additional context, my environment:

  • Windows 11
  • Edge
// ==UserScript==
// @name         CHATGPT Enter Window Resize Fix
// @namespace    https://chat.openai.com/chat
// @version      1
// @description  Presses enter even if window is resized on chatgpt
// @author       Miguel
// @match        https://chat.openai.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=greasyfork.org
// @grant        none
// ==/UserScript==

// thank you chris20
(function () {
    'use strict';
    let resize;
    console.log("Running resize fix script")

    document.addEventListener('keydown', function (event) {

        if (event.key === 'Enter' && !event.altKey && !event.shiftKey) {
            event.preventDefault();
            //console.log("waiting...");
            //let startTime = performance.now();
            //setTimeout(dispatchSubmit, 1500);
            console.log("Sent");
            //console.log("in", startTime - performance.now(), " time");
        }
    });

    function dispatchSubmit() {
        const button = document.querySelector('form button');
        if (button.disabled)
        {
            console.log("not run");
            return;
        }
        const rect = button.getBoundingClientRect();
        const x = rect.left + (rect.width / 2);
        const y = rect.top + (rect.height / 2);
        const clickEvent = new MouseEvent('click', {
            view: window,
            bubbles: true,
            cancelable: true,
            clientX: x,
            clientY: y
        });

        button.dispatchEvent(clickEvent);

    }
})();

Came here because I was having the same annoying issue with Enter not working whenever the sidebar was hidden (which, I think, happens whenever the browser is half the size of my screen).

WIN + ALT + Enter seems to work and is by far the easiest/quickest solution, at least for me! Of course a TM/alt script should also work. (:

Thank you @mhyoo1 for sharing this!

Hey, so none of these methods actually worked for me, so i have made something with the help of gpt, it just replaces the function of TAB to ctrl and now you can send the text by clicking CTRL+enter, but you need to get used to give it a bit of delay betwenn keystrokes since i dont know how to improve it

// ==UserScript==
// @name         Enter Converter thanks to gpt lol
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Converts Ctrl key press to focus on the next focusable element and then trigger Enter key press
// @author       Your name
// @match        https://chat.openai.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Function to handle key press events
    function handleKeyPress(event) {
        // Check if Ctrl key is pressed
        if (event.ctrlKey) {
            // Prevent default behavior
            event.preventDefault();

            // Focus on the next focusable element
            focusOnNextElement();
        }
    }

    // Function to focus on the next focusable element
    function focusOnNextElement() {
        var currentElement = document.activeElement;
        var nextElement = currentElement.nextElementSibling;

        while (nextElement) {
            if (nextElement.tabIndex !== -1) {
                nextElement.focus();
                // Trigger "Enter" key press
                var enterEvent = new KeyboardEvent('keydown', {
                    key: 'Enter',
                });
                nextElement.dispatchEvent(enterEvent);
                return;
            }
            nextElement = nextElement.nextElementSibling;
        }

        // If no next focusable element found, focus on the first focusable element
        var firstElement = document.querySelector('[tabindex="0"]');
        if (firstElement) {
            firstElement.focus();
            // Trigger "Enter" key press
            var enterEvent = new KeyboardEvent('keydown', {
                key: 'Enter',
            });
            firstElement.dispatchEvent(enterEvent);
        }
    }

    // Add event listener for keydown events on the document
    document.addEventListener('keydown', handleKeyPress);
})();

As seems to be customary, none of these scripts seemed to work for me.

Below is my solution:

// ==UserScript==
// @name         ChatGPT Mobile Layout Enter Key Submit
// @namespace    https://chat.openai.com/chat
// @version      1
// @description  Enables Enter key submission
// @author       Lodimas
// @match        https://chat.openai.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Access the textarea by its ID
    var textarea = document.getElementById('prompt-textarea');

    // Access the button by its data-testid attribute
    var sendbutton = document.querySelector('button[data-testid="send-button"]');

    // Function to handle keypress event
    function handleKeyPress(event) {
        // Check if the Enter key is pressed
        if (event.keyCode === 13) {
            event.preventDefault();
            // Re-capture button from DOM
            sendbutton = document.querySelector('button[data-testid="send-button"]');
            if (sendbutton && !event.shiftKey) {
                sendbutton.click();
            }
        }
    }

    // Add the event listener to the textarea
    if (textarea) {
        textarea.addEventListener('keypress', handleKeyPress);
    }
})();
1 Like

Tab+Enter works when the window size is small. (Windows PC)

1 Like

Thanks for this. I have adapted it for use on chatgpt dot com

// ==UserScript==
// @name         ChatGPT.com Mobile Layout Enter Key Fix
// @namespace    https://chatgpt.com
// @version      2
// @description  Enables Enter key submission on mobile layout
// @author       rbutera
// @match        https://chatgpt.com/*
// @grant        none
// ==/UserScript==


// this is forked from work by Lodimas - adapted for chatgpt.com
(function() {
    'use strict';

    // Access the textarea by its ID
    var textarea = document.getElementById('prompt-textarea');

    // Access the button by its data-testid attribute
    var sendbutton = document.querySelector('button[data-testid="fruitjuice-send-button"]');

    // Function to handle keypress event
    function handleKeyPress(event) {
        // Check if the Enter key is pressed
        if (event.keyCode === 13) {
            event.preventDefault();
            // Re-capture button from DOM
            sendbutton = document.querySelector('button[data-testid="fruitjuice-send-button"]');
            if (sendbutton && !event.shiftKey) {
                sendbutton.click();
            }
        }
    }

    // Add the event listener to the textarea
    if (textarea) {
        textarea.addEventListener('keypress', handleKeyPress);
    }
})();
2 Likes