Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix scroll behaviour and "Scroll to bottom" button appearance #8895

Merged
merged 6 commits into from Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/assets/variables.scss
Expand Up @@ -82,6 +82,8 @@ $chat-font-size: 15px;
$chat-line-height: 1.6em;

// fade transition
$fade-transition: all var(--animation-quick, 100ms) ease-in-out;

.fade {
&-enter {
opacity: 0;
Expand All @@ -97,7 +99,7 @@ $chat-line-height: 1.6em;
}
&-enter-active,
&-leave-active {
transition: all 150ms ease-in-out;
transition: $fade-transition;
}
}

Expand All @@ -120,7 +122,7 @@ $chat-line-height: 1.6em;
}
&-enter-active,
&-leave-active {
transition: all 150ms ease-in-out;
transition: $fade-transition;
/* force top container to resize during animation */
position: absolute !important;
}
Expand Down
16 changes: 4 additions & 12 deletions src/components/ChatView.vue
Expand Up @@ -40,20 +40,15 @@
</transition>
<MessagesList role="region"
:aria-label="t('spreed', 'Conversation messages')"
:is-chat-scrolled-to-bottom="isChatScrolledToBottom"
:token="token"
:is-visible="isVisible"
@set-chat-scrolled-to-bottom="setScrollStatus" />
:is-visible="isVisible" />
<NewMessageForm role="region"
:token="token"
:is-chat-scrolled-to-bottom="isChatScrolledToBottom"
:aria-label="t('spreed', 'Post message')" />
</div>
</template>

<script>
import { getCapabilities } from '@nextcloud/capabilities'

import MessagesList from './MessagesList/MessagesList.vue'
import NewMessageForm from './NewMessageForm/NewMessageForm.vue'

Expand All @@ -78,7 +73,6 @@ export default {
data() {
return {
isDraggingOver: false,
isChatScrolledToBottom: getCapabilities()?.spreed?.config?.chat?.legacy || false,
}
},

Expand Down Expand Up @@ -134,16 +128,14 @@ export default {
// Uploads and shares the files
this.$store.dispatch('initialiseUpload', { files, token: this.token, uploadId })
},

setScrollStatus(payload) {
this.isChatScrolledToBottom = payload
},
},

}
</script>

<style lang="scss" scoped>
@import '../assets/variables';

.chatView {
width: 100%;
height: 100%;
Expand Down Expand Up @@ -195,7 +187,7 @@ export default {
}
&-enter-active,
&-leave-active {
transition: all 150ms ease-in-out;
transition: $fade-transition;
}
}
</style>