Skip to content

Commit

Permalink
fix: Workaround composing mode in vue for inputs on mobile.
Browse files Browse the repository at this point in the history
  • Loading branch information
jlewallen committed May 12, 2021
1 parent c9f1901 commit c67a8fe
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions portal/src/views/comments/Comments.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

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

<div v-if="!errorMessage" class="error">{{ errorMessage }}</div>
Expand Down Expand Up @@ -82,7 +82,12 @@
v-if="newReply && newReply.threadId === post.id"
>
<UserPhoto :user="user"></UserPhoto>
<input type="text" placeholder="Reply to comment" v-model="newReply.body" />
<input
type="text"
placeholder="Reply to comment"
v-model="newReply.body"
@input="$event.target.composing = false"
/>
<button type="submit" class="new-comment-submit" v-if="newReply.body">Post</button>
</form>
</transition>
Expand Down Expand Up @@ -152,12 +157,12 @@ export default Vue.extend({
newComment: {
projectId: typeof this.parentData === "number" ? this.parentData : null,
bookmark: null,
body: null,
body: "",
},
newReply: {
projectId: typeof this.parentData === "number" ? this.parentData : null,
bookmark: null,
body: null,
body: "",
threadId: null,
},
errorMessage: null,
Expand Down

0 comments on commit c67a8fe

Please sign in to comment.