Skip to content

Commit 8470c13

Browse files
committed
Focus on the input when clicked outside the input
Fixed in MR list and branch list components. Earlier clicking right outside the input box closed the dropdown, which was unexpected behaviour. To make it consistent with the behaviour of select2 jquery plugin, I have made clicking outside the input focus on the input by using a label.
1 parent f6a201a commit 8470c13

File tree

4 files changed

+29
-28
lines changed

4 files changed

+29
-28
lines changed

app/assets/javascripts/ide/components/branches/search_list.vue

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,17 @@ export default {
5858

5959
<template>
6060
<div>
61-
<div class="dropdown-input mt-3 pb-3 mb-0 border-bottom">
62-
<div class="position-relative">
63-
<input
64-
ref="searchInput"
65-
v-model="search"
66-
:placeholder="__('Search branches')"
67-
type="search"
68-
class="form-control dropdown-input-field"
69-
@input="searchBranches"
70-
/>
71-
<icon :size="18" name="search" class="input-icon" />
72-
</div>
73-
</div>
61+
<label class="dropdown-input pt-3 pb-3 mb-0 border-bottom block position-relative" @click.stop>
62+
<input
63+
ref="searchInput"
64+
v-model="search"
65+
:placeholder="__('Search branches')"
66+
type="search"
67+
class="form-control dropdown-input-field"
68+
@input="searchBranches"
69+
/>
70+
<icon :size="18" name="search" class="input-icon" />
71+
</label>
7472
<div class="dropdown-content ide-merge-requests-dropdown-content d-flex">
7573
<gl-loading-icon
7674
v-if="isLoading"

app/assets/javascripts/ide/components/merge_requests/list.vue

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,17 @@ export default {
7676

7777
<template>
7878
<div>
79-
<div class="dropdown-input mt-3 pb-3 mb-0 border-bottom">
80-
<div class="position-relative">
81-
<tokened-input
82-
v-model="search"
83-
:tokens="searchTokens"
84-
:placeholder="__('Search merge requests')"
85-
@focus="onSearchFocus"
86-
@input="searchMergeRequests"
87-
@removeToken="setSearchType(null)"
88-
/>
89-
<icon :size="18" name="search" class="input-icon" />
90-
</div>
91-
</div>
79+
<label class="dropdown-input pt-3 pb-3 mb-0 border-bottom block" @click.stop>
80+
<tokened-input
81+
v-model="search"
82+
:tokens="searchTokens"
83+
:placeholder="__('Search merge requests')"
84+
@focus="onSearchFocus"
85+
@input="searchMergeRequests"
86+
@removeToken="setSearchType(null)"
87+
/>
88+
<icon :size="18" name="search" class="input-icon" />
89+
</label>
9290
<div class="dropdown-content ide-merge-requests-dropdown-content d-flex">
9391
<gl-loading-icon
9492
v-if="isLoading"
@@ -107,7 +105,7 @@ export default {
107105
<span class="d-flex append-right-default ide-search-list-current-icon">
108106
<icon :size="18" name="search" />
109107
</span>
110-
<span> {{ searchType.label }} </span>
108+
<span>{{ searchType.label }}</span>
111109
</button>
112110
</li>
113111
</template>

app/assets/stylesheets/page_bundles/ide.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ $ide-commit-header-height: 48px;
11881188

11891189
.input-icon {
11901190
right: auto;
1191-
left: 10px;
1191+
left: 26px;
11921192
top: 50%;
11931193
transform: translateY(-50%);
11941194
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: Fix an issue where clicking outside the MR/branch search box in WebIDE closed the dropdown.
3+
merge_request: 31523
4+
author:
5+
type: fixed

0 commit comments

Comments
 (0)