Skip to content

Commit

Permalink
Android keyboard fix #50
Browse files Browse the repository at this point in the history
  • Loading branch information
adamberecz committed Mar 30, 2021
1 parent b949ddb commit c11e5f9
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist/multiselect.global.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/multiselect.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/multiselect.vue2.global.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/multiselect.vue2.js

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions src/Multiselect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,17 @@
<template v-if="mode !== 'tags' && searchable && !disabled">
<div class="multiselect-search">
<input
v-model="search"
:modelValue="search"
:value="search"
@focus.stop="openDropdown"
@blur.stop="closeDropdown"
@keyup.stop.esc="handleEsc"
@keyup.stop.enter="selectPointer"
@keydown.delete="handleSearchBackspace"
@keydown.stop.up="backwardPointer"
@keydown.stop.down="forwardPointer"
@keyup="handleSearchInput"
@select="handleSearchInput"
ref="input"
/>
</div>
Expand Down Expand Up @@ -81,7 +84,8 @@
:style="{ width: tagsSearchWidth }"
>
<input
v-model="search"
:modelValue="search"
:value="search"
@focus.stop="openDropdown"
@blur.stop="closeDropdown"
@keyup.stop.esc="handleEsc"
Expand All @@ -90,6 +94,8 @@
@keydown.delete="handleSearchBackspace"
@keydown.stop.up="backwardPointer"
@keydown.stop.down="forwardPointer"
@keyup="handleSearchInput"
@select="handleSearchInput"
:style="{ width: tagsSearchWidth }"
ref="input"
/>
Expand Down
5 changes: 5 additions & 0 deletions src/composables/useKeyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ export default function useKeyboard (props, context, dependencies)
}
}

const handleSearchInput = (e) => {
search.value = e.target.value
}

const handleAddTag = (e) => {
if (e.keyCode === 13 && (addTagOn.value.indexOf('enter') !== -1 || !createTag.value)) {
selectPointer()
Expand All @@ -49,6 +53,7 @@ export default function useKeyboard (props, context, dependencies)
handleBackspace,
handleEsc,
handleSearchBackspace,
handleSearchInput,
handleAddTag,
}
}

0 comments on commit c11e5f9

Please sign in to comment.