Skip to content

Fix merge request dropdown branch input not detecting changes

What does this MR do and why?

Refs #322048 (closed)
Refs #260332 (closed)

This MR fixes issues with the Create Merge Request dropdown.

These issues fall into two categories:

  • Changes to the input not being detected.
  • Racing between user and async HTTP requests.

Another issue that is fixed is that processTab method's window.getSelection().removeAllRanges(); does nothing in Firefox. For some reason in Firefox removing selection works in all other cases except for selections within an input or textarea element[1][2]. This was replaced with moving the caret to the end of input when pressing tab.

There is also a related issue #260332 (closed) in which changes to the branch input are not detected. I believe the cause may be same as in this issue, and here this is fixed by adding input event handling to the branch input as well. This catches for example mouse paste. Since there are no reproduction steps in the issue, I can't be sure if this fixes all intermittent issues.

Screenshots or screen recordings

I have currently no ability to record, so I'll describe a few cases. See also gifs in #322048 (closed)

  • Tapping backspace at a specific pace used to cause racing with HTTP requests. Now this feels natural and debounces correctly.
  • Pressing backspace when there is only one character left used to re-input the character once the HTTP request is done. Now the input stays empty when you remove the last character.
  • In some cases the input would show "Source is not available" even if it is. Now at least these cases should be handled correctly: mouse paste, clicking outside the input, clicking inside the input, arrow keys, tab.

How to set up and validate locally

  1. Open a project with issues.
  2. Open an issue.
  3. Click the dropdown on the side of the "Create merge request" button.
  4. Try out the cases mentioned above.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by indigane

Merge request reports