GitLab - Default Add Comment

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

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

Autor
squiter
Denně instalací
0
Celkem instalací
1
Hodnocení
0 0 0
Verze
1.0
Vytvořeno
20. 02. 2026
Aktualizováno
20. 02. 2026
Size
1,9 KB
Licence
MIT
Spustit na

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.