feat: disable autocomplete on inputs + keyboard navigation focus
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
<AppSearchEntry
|
||||
v-for="(shortcut, shortcutIndex) in theOutput"
|
||||
:key="`shortcut-${shortcutIndex}`"
|
||||
:ref="`item-${shortcutIndex}`"
|
||||
:shortcut="shortcut"
|
||||
@action="$emit('action', shortcut.action)"
|
||||
/>
|
||||
@@ -62,6 +63,7 @@ export default {
|
||||
outputHash: "",
|
||||
theOutput: [],
|
||||
cache: {},
|
||||
currentItem: -1,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -119,6 +121,12 @@ export default {
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
document.addEventListener("keydown", this.nextItem)
|
||||
},
|
||||
destroyed() {
|
||||
document.removeEventListener("keydown", this.nextItem)
|
||||
},
|
||||
methods: {
|
||||
async output(search) {
|
||||
const that = this
|
||||
@@ -196,6 +204,24 @@ export default {
|
||||
const hex = val.toString(16).toUpperCase()
|
||||
return `00000000${hex}`.slice(-8)
|
||||
},
|
||||
nextItem(e) {
|
||||
if (e.keyCode === 38 && this.currentItem > 0) {
|
||||
e.preventDefault()
|
||||
this.currentItem--
|
||||
this.$nextTick().then(() => {
|
||||
this.$refs[`item-${this.currentItem}`][0].$el.focus()
|
||||
})
|
||||
} else if (
|
||||
e.keyCode === 40 &&
|
||||
this.currentItem < this.theOutput.length - 1
|
||||
) {
|
||||
e.preventDefault()
|
||||
this.currentItem++
|
||||
this.$nextTick().then(() => {
|
||||
this.$refs[`item-${this.currentItem}`][0].$el.focus()
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
v-model="search"
|
||||
v-focus
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
name="command"
|
||||
:placeholder="$t('app.type_a_command_search')"
|
||||
class="
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<div class="flex flex-col my-4 mx-6">
|
||||
<input
|
||||
v-model="filterText"
|
||||
type="search"
|
||||
type="search" autocomplete="off"
|
||||
class="
|
||||
bg-primaryLight
|
||||
border border-dividerLight
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
class="input floating-input"
|
||||
placeholder=" "
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
@keyup.enter="addNewCollection"
|
||||
/>
|
||||
<label for="selectLabelAdd">
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
class="input floating-input"
|
||||
placeholder=" "
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
@keyup.enter="addFolder"
|
||||
/>
|
||||
<label for="selectLabelAddFolder">
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<select
|
||||
id="team"
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
autofocus
|
||||
class="
|
||||
bg-transparent
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
class="input floating-input"
|
||||
placeholder=" "
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
@keyup.enter="saveCollection"
|
||||
/>
|
||||
<label for="selectLabelEdit">
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
class="input floating-input"
|
||||
placeholder=" "
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
@keyup.enter="editFolder"
|
||||
/>
|
||||
<label for="selectLabelEditFolder">
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
class="input floating-input"
|
||||
placeholder=" "
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
@keyup.enter="saveRequest"
|
||||
/>
|
||||
<label for="selectLabelEditReq">
|
||||
|
||||
@@ -127,6 +127,7 @@
|
||||
<div class="select-wrapper">
|
||||
<select
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
class="select"
|
||||
autofocus
|
||||
@change="
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
class="input floating-input"
|
||||
placeholder=" "
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
@keyup.enter="saveRequestAs"
|
||||
/>
|
||||
<label for="selectLabelSaveReq">
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
class="input floating-input"
|
||||
placeholder=" "
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
@keyup.enter="addNewCollection"
|
||||
/>
|
||||
<label for="selectLabelGqlAdd">
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
class="input floating-input"
|
||||
placeholder=" "
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
@keyup.enter="addFolder"
|
||||
/>
|
||||
<label for="selectLabelGqlAddFolder">
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
class="input floating-input"
|
||||
placeholder=" "
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
@keyup.enter="saveCollection"
|
||||
/>
|
||||
<label for="selectLabelGqlEdit">
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
class="input floating-input"
|
||||
placeholder=" "
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
@keyup.enter="editFolder"
|
||||
/>
|
||||
<label for="selectLabelGqlEditFolder">
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
class="input floating-input"
|
||||
placeholder=" "
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
@keyup.enter="saveRequest"
|
||||
/>
|
||||
<label for="selectLabelGqlEditReq">
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
v-if="showCollActions"
|
||||
v-model="filterText"
|
||||
type="search"
|
||||
autocomplete="off"
|
||||
:placeholder="$t('action.search')"
|
||||
class="bg-transparent flex w-full py-2 px-4"
|
||||
/>
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
<input
|
||||
v-model="filterText"
|
||||
type="search"
|
||||
autocomplete="off"
|
||||
:placeholder="$t('action.search')"
|
||||
class="bg-transparent flex w-full py-2 pr-2 pl-4"
|
||||
/>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
class="input floating-input"
|
||||
placeholder=" "
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
@keyup.enter="addNewEnvironment"
|
||||
/>
|
||||
<label for="selectLabelEnvAdd">
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
class="input floating-input"
|
||||
placeholder=" "
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
:disabled="editingEnvironmentIndex === 'Global'"
|
||||
@keyup.enter="saveEnvironment"
|
||||
/>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
placeholder=" "
|
||||
type="email"
|
||||
name="email"
|
||||
autocomplete="email"
|
||||
autocomplete="off"
|
||||
required
|
||||
spellcheck="false"
|
||||
autofocus
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
v-model="url"
|
||||
v-focus
|
||||
type="url"
|
||||
autocomplete="off"
|
||||
spellcheck="false"
|
||||
class="
|
||||
bg-primaryLight
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<input
|
||||
v-model="graphqlFieldsFilterText"
|
||||
type="search"
|
||||
autocomplete="off"
|
||||
:placeholder="$t('action.search')"
|
||||
class="bg-transparent flex w-full p-4 py-2"
|
||||
/>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<input
|
||||
v-model="filterText"
|
||||
type="search"
|
||||
autocomplete="off"
|
||||
class="bg-transparent flex w-full p-4 py-2"
|
||||
:placeholder="$t('action.search')"
|
||||
/>
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
"
|
||||
name="url"
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
spellcheck="false"
|
||||
:placeholder="$t('request.url')"
|
||||
autofocus
|
||||
@@ -166,6 +167,7 @@
|
||||
:placeholder="$t('request.name')"
|
||||
name="request-name"
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
class="mb-2 input"
|
||||
@keyup.enter="saveOptions.tippy().hide()"
|
||||
/>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
v-model="url"
|
||||
v-focus
|
||||
type="url"
|
||||
autocomplete="off"
|
||||
spellcheck="false"
|
||||
class="
|
||||
bg-primaryLight
|
||||
@@ -69,6 +70,7 @@
|
||||
class="input"
|
||||
:placeholder="$t('mqtt.topic_name')"
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
spellcheck="false"
|
||||
/>
|
||||
</div>
|
||||
@@ -83,6 +85,7 @@
|
||||
v-model="msg"
|
||||
class="input"
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
:placeholder="$t('mqtt.message')"
|
||||
spellcheck="false"
|
||||
/>
|
||||
@@ -112,6 +115,7 @@
|
||||
id="sub_topic"
|
||||
v-model="sub_topic"
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
:placeholder="$t('mqtt.topic_name')"
|
||||
spellcheck="false"
|
||||
class="input"
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
v-model="url"
|
||||
v-focus
|
||||
type="url"
|
||||
autocomplete="off"
|
||||
spellcheck="false"
|
||||
:class="{ error: !urlValid }"
|
||||
class="
|
||||
@@ -94,6 +95,7 @@
|
||||
name="event_name"
|
||||
:placeholder="$t('socketio.event_name')"
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
:disabled="!connectionState"
|
||||
/>
|
||||
</div>
|
||||
@@ -123,6 +125,7 @@
|
||||
name="message"
|
||||
:placeholder="$t('count.message', { count: index + 1 })"
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
:disabled="!connectionState"
|
||||
@keyup.enter="connectionState ? sendMessage() : null"
|
||||
/>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
v-model="server"
|
||||
v-focus
|
||||
type="url"
|
||||
autocomplete="off"
|
||||
:class="{ error: !serverValid }"
|
||||
class="
|
||||
bg-primaryLight
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
focus-visible:border-dividerDark
|
||||
"
|
||||
type="url"
|
||||
autocomplete="off"
|
||||
spellcheck="false"
|
||||
:class="{ error: !urlValid }"
|
||||
:placeholder="$t('websocket.url')"
|
||||
@@ -89,6 +90,7 @@
|
||||
:placeholder="$t('count.protocol', { count: index + 1 })"
|
||||
name="message"
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
/>
|
||||
<span>
|
||||
<ButtonSecondary
|
||||
@@ -174,6 +176,7 @@
|
||||
v-model="communication.input"
|
||||
name="message"
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
:disabled="!connectionState"
|
||||
:placeholder="$t('websocket.message')"
|
||||
class="input"
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
ref="acInput"
|
||||
v-model="text"
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
:placeholder="placeholder"
|
||||
:spellcheck="spellcheck"
|
||||
:autocapitalize="autocapitalize"
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
class="input floating-input"
|
||||
placeholder=" "
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
@keyup.enter="addNewTeam"
|
||||
/>
|
||||
<label for="selectLabelTeamAdd">
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
class="input floating-input"
|
||||
placeholder=" "
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
@keyup.enter="saveTeam"
|
||||
/>
|
||||
<label for="selectLabelTeamEdit">
|
||||
|
||||
Reference in New Issue
Block a user