Skip to content

Commit 6f966e8

Browse files
committed
(UI) fix mobile auto focus behaviour
1 parent 942dc83 commit 6f966e8

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/ChatWindow/Room.vue

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,12 @@ export default {
300300
watch: {
301301
loadingMessages(val) {
302302
if (val) this.infiniteState = null
303-
else this.focusTextarea()
303+
else this.focusTextarea(true)
304304
},
305305
room(newVal, oldVal) {
306306
if (newVal.roomId && newVal.roomId !== oldVal.roomId) {
307307
this.loadingMessages = true
308-
this.resetMessage()
308+
this.resetMessage(true)
309309
this.$emit('typingMessage', this.message)
310310
}
311311
},
@@ -413,15 +413,15 @@ export default {
413413
addNewMessage(message) {
414414
this.newMessages.push(message)
415415
},
416-
resetMessage() {
416+
resetMessage(disableMobileFocus) {
417417
this.resetTextareaSize()
418418
this.message = ''
419419
this.editedMessage = {}
420420
this.messageReply = null
421421
this.file = null
422422
this.imageFile = null
423423
this.emojiOpened = false
424-
setTimeout(() => this.focusTextarea(), 0)
424+
setTimeout(() => this.focusTextarea(disableMobileFocus), 0)
425425
},
426426
resetImageFile() {
427427
this.imageFile = null
@@ -433,8 +433,8 @@ export default {
433433
if (!this.$refs['roomTextarea']) return
434434
this.$refs['roomTextarea'].style.height = '20px'
435435
},
436-
focusTextarea() {
437-
if (this.isMobile) return
436+
focusTextarea(disableMobileFocus) {
437+
if (detectMobile() && disableMobileFocus) return
438438
this.$refs['roomTextarea'].focus()
439439
},
440440
isMessageEmpty() {
@@ -619,7 +619,7 @@ export default {
619619
.container-scroll {
620620
background: var(--chat-content-bg-color);
621621
flex: 1;
622-
overflow-y: auto;
622+
overflow-y: scroll;
623623
margin-right: 1px;
624624
padding-top: 60px;
625625
-webkit-overflow-scrolling: touch;
@@ -671,7 +671,7 @@ export default {
671671
672672
.reply-container {
673673
display: flex;
674-
padding: 10px 10px 10px;
674+
padding: 10px 10px 0 10px;
675675
background: var(--chat-content-bg-color);
676676
align-items: center;
677677
max-width: 100%;
@@ -869,6 +869,10 @@ textarea {
869869
}
870870
}
871871
872+
.reply-container {
873+
padding: 5px 8px;
874+
}
875+
872876
.icon-scroll {
873877
bottom: 70px;
874878
}

0 commit comments

Comments
 (0)