Skip to content

Resizing Terminal is buggy because of the iframe #441

Open

Description

@GaetanRouzies

Describe the bug

The Terminal is not resizing correctly.

Link to a StackBlitz project which shows the error

https://demo.tutorialkit.dev/

Steps to reproduce

  1. Go to TutorialKit Demo
  2. Toggle the Terminal
  3. Try to resize the Terminal
  4. Sometime the resizing doesn't happens or is stuck

Expected behavior

The Terminal should resizing correctly.

Screenshots

Here's a video to show the bug

CleanShot.2025-03-20.at.10.40.15.mp4

Platform

  • TutorialKit version: Demo
  • OS: macOS
  • Browser: Chromium (Brave)
  • Version: 1.76

Additional context

I had this problem while making my own iframe and Terminal with panels I can resize. I fixed it by putting an overlay on the iframe when resizing. I think it’s because the iframe’s resize and mouse events stop the Terminal panel from resizing right.

Activity

  1. added
    bugSomething isn't working
    help wantedExtra attention is needed
    pr-welcomeAccepting pull requests for this change
    and removed
    help wantedExtra attention is needed
    on Mar 20, 2025
  2. AlokPy1484 commented on Sep 30, 2025

    @AlokPy1484

    Understanding of codebase:

    • TutorialKit uses Xterm js to emulate terminal in browser.
    • xterm’s fitAddon plugin is used to automatically resize terminal to fill the parent container
    • terminal related files are in ./packages/react/src/core/Terminal

    Observations:

    • terminal is buggy only when we increase its height, reducing height is smooth and if height is maxed then it latches with preview section
    • No issue with terminal resize when using site on mobile phone

    Solutions tried:

    • I tried to add a debounce to “onTerminalResize?.(terminal.cols, terminal.rows)” as it was being triggered every time we change height, I thought it's excessive repeated calls might be overloading fitAddon.fit(). But later found out that onTerminalResize is used to send new terminal dimensions to backend for rendering properties like font alignment, spacing, etc. It does not set terminal size in UI. For that “terminal.loadAddon(fitAddon);” is being used so I added debounce to it but still issue was not solved.

    I would like to work on it further, my approach will be to tweak the layout of Output section but for that I first need to find the files that defines it. Currently I am unable to find file where terminal and preview sections layout is defined (i.e. a file that contains something like .) It would be really helpful if someone could give we a direction on where should I find it and if my approach is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomerspr-welcomeAccepting pull requests for this change

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions