[go: up one dir, main page]

Skip to content

Capture Tabs and Enters when in the blocking MRs field to tokenize the input

What does this MR do and why?

For #508324 (closed)

Problem

When in the related/blocking MRs field for an MR, pressing Enter or Tab either submits the form or moves out of the field (respectively).
It's highly unlikely either behavior is the desired outcome for a user entering values in that field.

Changes

This MR captures the keypresses for either Enter or Tab and prevents their default behavior (submit & leave-the-field, respectively).

It also additionally triggers the onBlur behavior to "tokenize" the input immediately (instead of requiring an additional space input).

Notes

Note that because Paste was specifically mentioned in the issue, I've included multiple tests of a paste, then submit or Enter. The submit button works as expected both in the before and after, since a blur occurs on the field first, which tokenizes the input. The Enter input after the paste was broken before (which submitted the form without tokenizing the input), which dropped the value of the field entirely. That's been resolved regardless of pasting or not, since Enter no longer submits the form.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Before After
Enter Screencast_from_2025-02-03_12-39-56 Screencast_from_2025-02-03_12-43-55
Tab Screencast_from_2025-02-03_12-41-23 Screencast_from_2025-02-03_12-44-22
Paste, then submit Screencast_from_2025-02-03_12-42-26 Screencast_from_2025-02-03_12-44-47
Paste, then Enter Screencast_from_2025-02-03_12-53-37 Screencast_from_2025-02-03_12-52-34

How to set up and validate locally

  1. Go to the MR creation (or edit) page
  2. Use the "Merge request dependencies" input:
    • Direct typing, paste
    • Press Enter, Tab
Edited by Thomas Randolph

Merge request reports

Loading