Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
Remove use of keyboardevent.which as its deprecated in autocomplete
Andrew Bastin31cefd7dd066
diff --git a/components/ui/autocomplete.vue b/components/ui/autocomplete.vueindex 534ce5b74..8893d5ab3 100644--- a/components/ui/autocomplete.vue+++ b/components/ui/autocomplete.vue@@ -76,12 +76,6 @@</style><script>-const KEY_TAB = 9-const KEY_ESC = 27--const KEY_ARROW_UP = 38-const KEY_ARROW_DOWN = 40-export default {props: {spellcheck: {@@ -127,7 +121,7 @@ export default {methods: {updateSuggestions(event) {// Hide suggestions if ESC pressed.- if (event.which && event.which === KEY_ESC) {+ if (event.code && event.code === "Escape") {event.preventDefault()this.suggestionsVisible = falsethis.currentSuggestionIndex = -1@@ -151,14 +145,14 @@ export default {},handleKeystroke(event) {- switch (event.which) {- case KEY_ARROW_UP:+ switch (event.code) {+ case "ArrowUp":event.preventDefault()this.currentSuggestionIndex =this.currentSuggestionIndex - 1 >= 0 ? this.currentSuggestionIndex - 1 : 0break- case KEY_ARROW_DOWN:+ case "ArrowDown":event.preventDefault()this.currentSuggestionIndex =this.currentSuggestionIndex < this.suggestions.length - 1@@ -166,18 +160,13 @@ export default {: this.suggestions.length - 1break- case KEY_TAB:+ case "Tab":event.preventDefault()let activeSuggestion = this.suggestions[this.currentSuggestionIndex >= 0 ? this.currentSuggestionIndex : 0]- if (activeSuggestion) {- let input = this.text.substring(0, this.selectionStart)- this.text = input + activeSuggestion- }- break-- default:+ let input = this.text.substring(0, this.selectionStart)+ this.text = input + activeSuggestionbreak}},