Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite Terminal to fix issues #533

Open
cjyabraham opened this issue May 13, 2022 · 1 comment
Open

Rewrite Terminal to fix issues #533

cjyabraham opened this issue May 13, 2022 · 1 comment
Assignees
Labels
idea idea for the future

Comments

@cjyabraham
Copy link
Collaborator

Current terminal has the following problems:

  • FOUC when it initializes, starting very tall then going shorter
  • The terminal window goes very long on tablet widths (800px) and the text only fills the first half of it
  • In Safari lines of text are not visible, go below the fold or are partially hidden
@cjyabraham cjyabraham added the idea idea for the future label Jul 11, 2022
@cjyabraham cjyabraham moved this to Later in CNCF.io Jun 2, 2024
@Creatur3245
Copy link

  • It seems I was unable to retrieve the details for issue Rewrite Terminal to fix issues #533 (which is stated above) from the repository.

  • To assist you better with fixing the terminal issues, outlined below are the steps to address the problems you've mentioned. Here are the steps to solve the problems:

  1. FOUC (Flash of Unstyled Content) when it initializes:

    • Ensure that the CSS is loaded before the terminal initializes.

    • Add a CSS rule to set the initial height of the terminal container, preventing it from starting very tall.

  2. Terminal window goes very long on tablet widths (800px) and the text only fills the first half of it:

    • Adjust the CSS media queries to handle tablet widths properly.

    • Ensure the terminal container has a maximum width and the text fills the container appropriately.

  3. In Safari, lines of text are not visible, go below the fold, or are partially hidden:

    • Test the terminal in Safari to understand the specific rendering issues.

    • Apply CSS fixes or JavaScript adjustments to ensure compatibility with Safari.

  • Let's start by making adjustments to the CSS and possibly the JavaScript that initializes the terminal.

Step 1: Fix FOUC (Flash of Unstyled Content)

Add the following CSS to ensure the terminal container has a defined initial height:

/* CSS to prevent FOUC */
.terminal-container {
  height: 400px; /* Set a reasonable default height */
  transition: height 0.3s ease-in-out; /* Smooth transition for height changes */
}

Step 2: Adjust Terminal Window Width for Tablets

Modify the CSS media queries to handle tablet widths:

/* CSS for tablet widths */
@media (max-width: 800px) {
  .terminal-container {
    max-width: 100%; /* Ensure terminal doesn't exceed the screen width */
    width: 100%;
  }
  .terminal-text {
    width: 100%; /* Ensure text fills the container */
  }
}

Step 3: Safari Compatibility

Apply specific CSS fixes for Safari:

/* CSS hacks for Safari */
@media not all and (min-resolution:.001dpcm) {
  @supports (-webkit-appearance:none) {
    /* Safari specific styles */
    .terminal-container {
      overflow: hidden; /* Ensure content doesn't overflow */
    }
    .terminal-text {
      white-space: pre-wrap; /* Ensure text wraps properly */
    }
  }
}

Step 4: Ensure JavaScript Initializes Correctly

Modify the JavaScript to ensure the terminal initializes with the correct height and width:

// JavaScript initialization
document.addEventListener('DOMContentLoaded', function() {
  const terminalContainer = document.querySelector('.terminal-container');
  // Set initial height to prevent FOUC
  terminalContainer.style.height = '400px';

  // Adjust height based on content
  window.addEventListener('resize', function() {
    terminalContainer.style.height = window.innerHeight + 'px';
  });

  // Additional initialization code if necessary
});
  • These changes should address the issues you've mentioned. Please implement these changes in the respective CSS and JS files in your project, and test them to ensure they solve the problems.

  • If you need further assistance or specific file changes, please provide more details or access to the repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea idea for the future
Projects
Status: Later
Development

No branches or pull requests

3 participants