Skip to content

Commit

Permalink
Fix issues detected during review
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kommunarr committed Dec 20, 2024
1 parent 953ab80 commit 1a06600
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
18 changes: 11 additions & 7 deletions src/renderer/components/ft-input/ft-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,15 @@ export default defineComponent({

handleOptionClick: function (index) {
this.searchState.showOptions = false
if (this.visibleDataList[index].route) {
this.inputData = `ft:${this.visibleDataList[index].route}`
this.$emit('input', this.inputData)
const isSearchHistoryClick = this.visibleDataList[index].route
this.inputData = isSearchHistoryClick ? `ft:${this.visibleDataList[index].route}` : this.visibleDataList[index]
this.$emit('input', this.inputData)
this.handleClick()

// update displayed label to match name of the search history entry
if (isSearchHistoryClick) {
this.inputData = this.$refs.input.value = this.visibleDataList[index].name
} else {
this.inputData = this.visibleDataList[index]
this.$emit('input', this.inputData)
}
this.handleClick()
},

/**
Expand Down Expand Up @@ -321,6 +321,10 @@ export default defineComponent({
const lowerCaseInputData = this.inputData.toLowerCase()

this.visibleDataList = this.dataList.filter(x => {
if (x.name) {
return x.name.toLowerCase().indexOf(lowerCaseInputData) !== -1
}

return x.toLowerCase().indexOf(lowerCaseInputData) !== -1
})
},
Expand Down
4 changes: 3 additions & 1 deletion src/renderer/components/top-nav/top-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,12 @@ export default defineComponent({
goToSearch: async function (queryText, { event }) {
const doCreateNewWindow = event && event.shiftKey

const isFreeTubeInternalQuery = queryText.startsWith('ft:')

if (window.innerWidth <= MOBILE_WIDTH_THRESHOLD) {
this.$refs.searchContainer.blur()
this.showSearchContainer = false
} else {
} else if (!isFreeTubeInternalQuery) {
this.$refs.searchInput.blur()
}

Expand Down
1 change: 1 addition & 0 deletions src/renderer/components/top-nav/top-nav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
:show-data-when-empty="true"
@input="getSearchSuggestionsDebounce"
@click="goToSearch"
@clear="lastSuggestionQuery = ''"
/>
<font-awesome-icon
class="navFilterIcon navIcon"
Expand Down

0 comments on commit 1a06600

Please sign in to comment.