Page MenuHomePhabricator

Triple-clicking in Gerrit doesn't work with firefox (was: change subject selects unwanted space at the beginning)
Open, LowPublic

Description

This is a really minor point, but it still bugs me: when you triple-click the subject line of a Gerrit change (in PolyGerrit – haven’t tried the old UI), copy it, and paste it somewhere else, the pasted text will start with a single space. This is inconvenient, for example, when adding the subject to the deployment calendar, or when pasting it into the scap sync-file message argument ([[gerrit:123456| argh no space here]]). Can we fix this?

JavaScript workaround:

var textNode = document.querySelector('#commitMessageEditor .gr-change-view').childNodes[0];
if ( textNode.nodeName === '#text' ) {
    textNode.textContent = textNode.textContent.trim();
}

update 2022-02-25 seems to work with Chromium but triple clicking does not work on Firefox.

Event Timeline

Update: since the Gerrit 3 upgrade (T254158), triple-clicking no longer seems to work at all. For some reason. (Not just in the commit message, but also elsewhere, e. g. in review comments.)

hashar added a subscriber: hashar.

With Gerrit 3.3.9:

  • Chromium 98.0 allows triple clicking and there is no leading space
  • Firefox 91.6 doesn't have triple clicking at all

Gerrit had several issues with Firefox, one of them is the JavaScript event API being used with event.path which is Chrome specific and should be replaced by event.composedPath. I am guessing that is the same issue for triple clicking.

hashar renamed this task from Triple-clicking Gerrit change subject selects unwanted space at the beginning to Triple-clicking in Gerrit doesn't work with firefox (was: change subject selects unwanted space at the beginning).Feb 25 2022, 8:19 AM
hashar updated the task description. (Show Details)

I have looked at upstream Gerrit https://gerrit-review.googlesource.com/ which runs 3.5.0+. Triple clicking work with Firefox and there is no leading spaces. So I am assuming this will be fixed when we upgrade Gerrit.

After upgrading to Gerrit 3.5.4 (T307334), the triple clicking on the first line of the commit message still does NOT work on Firefox. A workaround is the change title can be copied to the clipboard via a paperclip icon.

I am moving the task to be revisited once we have upgraded to Gerrit 3.6.