Skip to content

Prevent conflict b/w search field and its dropdown

What does this MR do?

Stops the global search form's default "action" from fighting with dropdown items when using the keyboard to navigate the dropdown. e.preventDefault() is now called on the enter key when a dropdown item is already selected.

Unfortunately, the test does not actually catch failing behavior. Browsers prevent default behavior of form fields when simulating keypresses for security reasons, so the form's "action" would never be triggered. Updated to include a working test.

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

There may be a way to get the better test to work, but I couldn't find one using the existing test framework. Theoretically, we could use PhantomJS's sendEvent, which simulates the keypress in a more reliable way, but I don't think the current test framework provides access to the PhantomJS page.

Why was this MR needed?

To fix #22872 (closed), an oft-encountered nuisance.

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes #22872 (closed)

Merge request reports