Skip to content

Keyboard navigation for the label dropdown has an off-by-one error

Filipa Lacerda requested to merge filipa/gitlab-ce:bug-20752 into master

What does this MR do?

In the dropdown, when the user uses the up and down keys and then the enter key to select an option the wrong option was being selected in the labels.

The index was being calculated by counting all the li. In the assignee dropdown since there is a li.divider it was being counted as well. The code was preventing this by subtracting one which caused the error in the label dropdown. This solution fixes it by selecting only the li with options and then finding the index for the selected one.

Are there points in the code the reviewer needs to double check?

I am not sure there are any other possible li that do not have options. That would be a thing to check.

Why was this MR needed?

It was a bug.

What are the relevant issue numbers?

Closes #20752 (closed)

Screenshots (if relevant)

Does this MR meet the acceptance criteria?

Merge request reports