Skip to content

Commit e8b0a34

Browse files
committed
fix: fix chat visual text alignment issues on chat opening
1 parent 5cfd301 commit e8b0a34

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/react/Chat.css

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,26 @@ div.chat-wrapper {
44
/* z-index: 10; */
55
padding-left: calc(env(safe-area-inset-left) / 2);
66
padding-right: calc(env(safe-area-inset-right, 4px) / 2);
7+
box-sizing: content-box;
8+
overflow: hidden;
79
}
810

911
.chat-messages-wrapper {
1012
bottom: 40px;
1113
padding: 4px;
1214
padding-left: 0;
1315
max-height: var(--chatHeight);
14-
width: var(--chatWidth);
16+
width: calc(var(--chatWidth) - 5px); /* Custom scrollbar width */
1517
transform-origin: bottom left;
1618
transform: scale(var(--chatScale));
1719
pointer-events: none;
1820
}
1921

22+
/* Restore full width when chat is opened */
23+
.chat-messages-wrapper.chat-opened {
24+
width: var(--chatWidth);
25+
}
26+
2027
.chat-input-wrapper {
2128
bottom: 1px;
2229
width: calc(100% - 3px);

src/react/Chat.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const MessageLine = ({ message, currentPlayerName, chatOpened }: { message: Mess
1818
const [fadeState, setFadeState] = useState<'visible' | 'fading' | 'faded'>('visible')
1919

2020
useEffect(() => {
21+
if (window.debugStopChatFade) return
2122
// Start fading after 5 seconds
2223
const fadeTimeout = setTimeout(() => {
2324
setFadeState('fading')
@@ -324,7 +325,7 @@ export default ({
324325
return (
325326
<>
326327
<div
327-
className={`chat-wrapper chat-messages-wrapper ${usingTouch ? 'display-mobile' : ''}`} style={{
328+
className={`chat-wrapper chat-messages-wrapper ${usingTouch ? 'display-mobile' : ''} ${opened ? 'chat-opened' : ''}`} style={{
328329
userSelect: opened && allowSelection ? 'text' : undefined,
329330
}}
330331
>

0 commit comments

Comments
 (0)