fix: improve terminal sizing with delayed fit and flex layout

- Use double requestAnimationFrame before initial fitAddon.fit() to ensure DOM is settled
- Add display: flex to mobile-terminal-content for proper child sizing
- Add width: 100% to terminal-wrapper.mobile
- Ensure terminal fills parent container both horizontally and vertically
This commit is contained in:
Fusion
2026-05-24 13:38:15 +02:00
parent 2f44306089
commit caf11cdb8a
2 changed files with 10 additions and 1 deletions
+7 -1
View File
@@ -163,11 +163,17 @@ export const TerminalComponent: React.FC<TerminalProps> = ({
term.loadAddon(new WebLinksAddon());
term.open(terminalRef.current);
fitAddon.fit();
// Connect WebSocket
const ws = connectWebSocket();
// Fit after layout settles - use rAF to ensure DOM is ready
requestAnimationFrame(() => {
requestAnimationFrame(() => {
fitAddon.fit();
});
});
// Handle terminal input
term.onData((data) => {
if (ws.readyState !== WebSocket.OPEN) return;