Skip to content

Commit c67a8fe

Browse files
committed
fix: Workaround composing mode in vue for inputs on mobile.
vuejs/docs#804 vuejs/vue#9814 vuejs/vue#9777 (comment)
1 parent c9f1901 commit c67a8fe

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

portal/src/views/comments/Comments.vue

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
<form @submit.prevent="save(newComment)" class="new-comment">
66
<UserPhoto v-if="user" :user="user"></UserPhoto>
7-
<input type="text" :placeholder="placeholder" v-model="newComment.body" />
8-
<button type="submit" class="new-comment-submit" v-if="newComment.body">Post</button>
7+
<input type="text" :placeholder="placeholder" v-model="newComment.body" @input="$event.target.composing = false" />
8+
<button type="submit" class="new-comment-submit" v-if="newComment.body.length > 0">Post</button>
99
</form>
1010

1111
<div v-if="!errorMessage" class="error">{{ errorMessage }}</div>
@@ -82,7 +82,12 @@
8282
v-if="newReply && newReply.threadId === post.id"
8383
>
8484
<UserPhoto :user="user"></UserPhoto>
85-
<input type="text" placeholder="Reply to comment" v-model="newReply.body" />
85+
<input
86+
type="text"
87+
placeholder="Reply to comment"
88+
v-model="newReply.body"
89+
@input="$event.target.composing = false"
90+
/>
8691
<button type="submit" class="new-comment-submit" v-if="newReply.body">Post</button>
8792
</form>
8893
</transition>
@@ -152,12 +157,12 @@ export default Vue.extend({
152157
newComment: {
153158
projectId: typeof this.parentData === "number" ? this.parentData : null,
154159
bookmark: null,
155-
body: null,
160+
body: "",
156161
},
157162
newReply: {
158163
projectId: typeof this.parentData === "number" ? this.parentData : null,
159164
bookmark: null,
160-
body: null,
165+
body: "",
161166
threadId: null,
162167
},
163168
errorMessage: null,

0 commit comments

Comments
 (0)