Skip to content

Commit 73442a2

Browse files
committed
UI: Better handle the chat input position with CSS
This also solves scrolling issues with the main chat content when the height of the textarea increases.
1 parent 8042f76 commit 73442a2

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

css/chat_style-messenger.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,11 @@
9999
.message-body p em {
100100
color: rgb(110 110 110) !important;
101101
}
102+
102103
.editing-textarea {
103104
width: max(30rem) !important;
104105
}
106+
105107
.circle-you + .text .edit-control-button, .circle-you + .text .editing-textarea {
106108
color: #000 !important;
107109
}

css/main.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ div.svelte-362y77>*, div.svelte-362y77>.form>* {
404404
flex: 1;
405405
overflow: auto !important;
406406
border-radius: 0 !important;
407+
margin-bottom: 75px;
407408
}
408409

409410
.chat-parent .prose {
@@ -626,6 +627,9 @@ div.svelte-362y77>*, div.svelte-362y77>.form>* {
626627
max-width: 54rem;
627628
left: 50%;
628629
transform: translateX(-50%);
630+
position: absolute;
631+
bottom: 0;
632+
background: var(--body-background-fill);
629633
}
630634

631635
@media print {

js/main.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,3 +1065,30 @@ document.fonts.addEventListener("loadingdone", (event) => {
10651065
}
10661066
}, 50);
10671067
});
1068+
1069+
(function() {
1070+
const chatParent = document.querySelector(".chat-parent");
1071+
const chatInputRow = document.querySelector("#chat-input-row");
1072+
const originalMarginBottom = 75;
1073+
let originalHeight = chatInputRow.offsetHeight;
1074+
1075+
function updateMargin() {
1076+
const currentHeight = chatInputRow.offsetHeight;
1077+
const heightDifference = currentHeight - originalHeight;
1078+
chatParent.style.marginBottom = `${originalMarginBottom + heightDifference}px`;
1079+
}
1080+
1081+
// Watch for changes that might affect height
1082+
const observer = new MutationObserver(updateMargin);
1083+
observer.observe(chatInputRow, {
1084+
childList: true,
1085+
subtree: true,
1086+
attributes: true
1087+
});
1088+
1089+
// Also listen for window resize
1090+
window.addEventListener("resize", updateMargin);
1091+
1092+
// Initial call to set the margin based on current state
1093+
updateMargin();
1094+
})();

0 commit comments

Comments
 (0)