mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-06 03:46:39 +08:00
Merge pull request #7568 from aignatov-bio/ai-sci-10693-fix-microinteractions
Fix microinteractions global search [SCI-10693]
This commit is contained in:
commit
2c8a2bd295
2 changed files with 31 additions and 2 deletions
|
@ -78,10 +78,14 @@ input[type="checkbox"].sci-checkbox {
|
||||||
}
|
}
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
outline: none;
|
outline: 0;
|
||||||
outline-offset: 0;
|
outline-offset: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:focus + .sci-checkbox-label {
|
||||||
|
outline: 4px solid var(--sn-science-blue-hover);
|
||||||
|
}
|
||||||
|
|
||||||
&:disabled {
|
&:disabled {
|
||||||
cursor: default;
|
cursor: default;
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
class="!pr-9"
|
class="!pr-9"
|
||||||
:value="localQuery"
|
:value="localQuery"
|
||||||
@change="changeQuery"
|
@change="changeQuery"
|
||||||
|
@keydown="focusHistoryItem"
|
||||||
@keydown.enter="changeQuery"
|
@keydown.enter="changeQuery"
|
||||||
@blur="changeQuery"
|
@blur="changeQuery"
|
||||||
:placeholder="i18n.t('nav.search')"
|
:placeholder="i18n.t('nav.search')"
|
||||||
|
@ -30,9 +31,10 @@
|
||||||
<template v-slot:flyout >
|
<template v-slot:flyout >
|
||||||
<div v-for="(query, i) in reversedPreviousQueries" @click="setQuery(query)" :key="i"
|
<div v-for="(query, i) in reversedPreviousQueries" @click="setQuery(query)" :key="i"
|
||||||
ref="historyItems"
|
ref="historyItems"
|
||||||
|
@keydown="focusHistoryItem"
|
||||||
tabindex="1"
|
tabindex="1"
|
||||||
@keydown.enter="setQuery(query)"
|
@keydown.enter="setQuery(query)"
|
||||||
class="flex px-3 h-11 items-center gap-2 hover:bg-sn-super-light-grey cursor-pointer">
|
class="flex px-3 min-h-11 items-center gap-2 hover:bg-sn-super-light-grey cursor-pointer">
|
||||||
<i class="sn-icon sn-icon-history-search"></i>
|
<i class="sn-icon sn-icon-history-search"></i>
|
||||||
{{ query }}
|
{{ query }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -169,6 +171,7 @@ export default {
|
||||||
previousQueries: [],
|
previousQueries: [],
|
||||||
invalidQuery: false,
|
invalidQuery: false,
|
||||||
activeGroup: null,
|
activeGroup: null,
|
||||||
|
focusedHistoryItem: null,
|
||||||
totalElements: 0,
|
totalElements: 0,
|
||||||
searchGroups: [
|
searchGroups: [
|
||||||
'FoldersComponent',
|
'FoldersComponent',
|
||||||
|
@ -304,6 +307,28 @@ export default {
|
||||||
this.activeGroup = null;
|
this.activeGroup = null;
|
||||||
this.filters.group = null;
|
this.filters.group = null;
|
||||||
},
|
},
|
||||||
|
focusHistoryItem(event) {
|
||||||
|
if (this.focusedHistoryItem === null && (event.key === 'ArrowDown' || event.key === 'ArrowUp')) {
|
||||||
|
this.focusedHistoryItem = 0;
|
||||||
|
this.$refs.historyItems[this.focusedHistoryItem].focus();
|
||||||
|
} else if (event.key === 'ArrowDown') {
|
||||||
|
event.preventDefault();
|
||||||
|
this.focusedHistoryItem += 1;
|
||||||
|
if (this.focusedHistoryItem >= this.$refs.historyItems.length) {
|
||||||
|
this.focusedHistoryItem = 0;
|
||||||
|
}
|
||||||
|
this.$refs.historyItems[this.focusedHistoryItem].focus();
|
||||||
|
} else if (event.key === 'ArrowUp') {
|
||||||
|
event.preventDefault();
|
||||||
|
this.focusedHistoryItem -= 1;
|
||||||
|
if (this.focusedHistoryItem < 0) {
|
||||||
|
this.focusedHistoryItem = this.$refs.historyItems.length - 1;
|
||||||
|
}
|
||||||
|
this.$refs.historyItems[this.focusedHistoryItem].focus();
|
||||||
|
} else if (event.key === 'Escape') {
|
||||||
|
this.$refs.historyContainer.isOpen = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
resetFilters() {
|
resetFilters() {
|
||||||
this.filters = {
|
this.filters = {
|
||||||
created_at: {
|
created_at: {
|
||||||
|
|
Loading…
Add table
Reference in a new issue