Skip to content

Commit df5b2f9

Browse files
authored
Merge pull request #5 from ScottLogic/fix-scrolling-error
Fix scrolling error
2 parents 4a664b3 + 3ed4719 commit df5b2f9

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

chat_bots.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def render():
6262
message_list = document["messages-list"]
6363
message_list.clear()
6464
message_list <= (createLI(message) for message in Messages.messages)
65+
message_list.scrollTop = message_list.scrollHeight
6566

6667
if Messages.bot_typing:
6768
message_list.append(create_bot_typing_message())

styles/main.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
@import 'scrollbar.scss';
23
@import "messages.scss";
34
@import "editor.scss";
45
@import "console.scss";

styles/messages.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ $dark: #32465a;
6363
overflow-y: auto;
6464
overflow-x: hidden;
6565
margin: 0;
66+
scroll-behavior: smooth;
67+
display: flex;
68+
flex-direction: column;
69+
justify-content: flex-end;
70+
@include withScrollbar();
6671
li {
6772
margin: 15px 15px 0px 15px;
6873
width: calc(100% - 25px);

styles/scrollbar.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@mixin withScrollbar() {
2+
&::-webkit-scrollbar
3+
{
4+
width: 6px;
5+
background-color: #F5F5F5;
6+
&-track
7+
{
8+
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
9+
background-color: #F5F5F5;
10+
}
11+
&-thumb
12+
{
13+
background-color: #32465a;
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)