Skip to content

Commit 1a06600

Browse files
committed
Fix issues detected during review
Fix focus being lost for a second during searching of search history entry causing clear text button to phase away for a moment. Fix clear text button event not being noticed by the logic in top-nav. Fix spacebar error issue by adding check in updateVisibleDataList function.
1 parent 953ab80 commit 1a06600

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

src/renderer/components/ft-input/ft-input.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -240,15 +240,15 @@ export default defineComponent({
240240

241241
handleOptionClick: function (index) {
242242
this.searchState.showOptions = false
243-
if (this.visibleDataList[index].route) {
244-
this.inputData = `ft:${this.visibleDataList[index].route}`
245-
this.$emit('input', this.inputData)
243+
const isSearchHistoryClick = this.visibleDataList[index].route
244+
this.inputData = isSearchHistoryClick ? `ft:${this.visibleDataList[index].route}` : this.visibleDataList[index]
245+
this.$emit('input', this.inputData)
246+
this.handleClick()
247+
248+
// update displayed label to match name of the search history entry
249+
if (isSearchHistoryClick) {
246250
this.inputData = this.$refs.input.value = this.visibleDataList[index].name
247-
} else {
248-
this.inputData = this.visibleDataList[index]
249-
this.$emit('input', this.inputData)
250251
}
251-
this.handleClick()
252252
},
253253

254254
/**
@@ -321,6 +321,10 @@ export default defineComponent({
321321
const lowerCaseInputData = this.inputData.toLowerCase()
322322

323323
this.visibleDataList = this.dataList.filter(x => {
324+
if (x.name) {
325+
return x.name.toLowerCase().indexOf(lowerCaseInputData) !== -1
326+
}
327+
324328
return x.toLowerCase().indexOf(lowerCaseInputData) !== -1
325329
})
326330
},

src/renderer/components/top-nav/top-nav.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,12 @@ export default defineComponent({
167167
goToSearch: async function (queryText, { event }) {
168168
const doCreateNewWindow = event && event.shiftKey
169169

170+
const isFreeTubeInternalQuery = queryText.startsWith('ft:')
171+
170172
if (window.innerWidth <= MOBILE_WIDTH_THRESHOLD) {
171173
this.$refs.searchContainer.blur()
172174
this.showSearchContainer = false
173-
} else {
175+
} else if (!isFreeTubeInternalQuery) {
174176
this.$refs.searchInput.blur()
175177
}
176178

src/renderer/components/top-nav/top-nav.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
:show-data-when-empty="true"
9999
@input="getSearchSuggestionsDebounce"
100100
@click="goToSearch"
101+
@clear="lastSuggestionQuery = ''"
101102
/>
102103
<font-awesome-icon
103104
class="navFilterIcon navIcon"

0 commit comments

Comments
 (0)