Skip to content

fix(search-box-by-type): Fix clear button focus

Nathan Friend requested to merge nfriend-fix-search-box-by-type-focus into master

What does this MR do?

Fixes the focus behavior of the "clear" button to not lose focus when clicked.

Previously, when nested inside a GlNewDropdown, clicking the "clear" button would cause the dropdown to be closed. This was because the clear button - which owns the focus - was removed from the DOM on click, relinquishing the the focus to the window.

Now the button is simply hidden (display: none), and the focus stays within the GlNewDropdown, allowing it to stay open.

GIFs

Before After
2020-06-25_08.00.48 2020-06-25_08.00.10

Merge request reports