GitLab - Default Add Comment

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

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

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.

(I already have a user style manager, let me install it!)

Tác giả
squiter
Cài đặt hàng ngày
0
Số lần cài đặt
1
Đánh giá
0 0 0
Phiên bản
1.0
Đã tạo
20-02-2026
Đã cập nhật
20-02-2026
Kích thước
2 KB
Giấy phép
MIT
Áp dụng cho

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.