GitLab - Default Add Comment

Makes "Add comment now" the default action in GitLab and remove the Start a Review

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

Autore
squiter
Installazioni giornaliere
0
Installazioni totali
1
Valutazione
0 0 0
Versione
1.0
Creato il
20/02/2026
Aggiornato il
20/02/2026
Dimensione
1,88 KB
Licenza
MIT
Applica a

What this script does

GitLab normally defaults to Start a review, which makes pressing Enter start a review instead of posting a comment immediately.

This userscript changes that behavior by:

  • Hiding the Start a review button
  • Making Add comment now the default action
  • Pressing Enter submits the comment
  • Pressing Shift + Enter inserts a newline (normal markdown behavior)

The script works on GitLab merge request discussions and comment forms.


Why this exists

Many users prefer fast single comments instead of review mode.
This script optimizes the workflow to behave more like chat or GitHub-style commenting.


Technical details

  • Uses stable data-testid selectors when available.
  • Uses a MutationObserver because GitLab is a Vue SPA and frequently re-renders the DOM.
  • The script does not bypass GitLab logic — it clicks GitLab’s own button, so validation and quick actions still work normally.

Compatibility

✔ GitLab.com
✔ Most self-hosted GitLab instances (if URL match is adjusted)

Tested with the modern GitLab UI (Vue-based editor).


Known limitations

  • GitLab UI updates may break selectors in the future.
  • The script only acts when the comment button is enabled.
  • If another extension modifies GitLab comments, conflicts are possible.

Safety

This script:

  • Does not send data anywhere
  • Does not modify network requests
  • Runs entirely locally in your browser

Customization

If you want different behavior:

  • Change Enter to submit only with Ctrl/Cmd
  • Keep Start Review visible
  • Enable/disable per page

Feel free to fork and modify.