Skip to content

Conversation

@ATiwari03-03-2004
Copy link

Description

This PR fixes the variable height issue of code block by introducing fixed height for the code block

Validation

Screen.Recording.2025-12-25.161204.mp4

Related Issues

Fixes #8425

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run pnpm format to ensure the code follows the style guide.
  • I have run pnpm test to check if all tests are passing.
  • I have run pnpm build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

@ATiwari03-03-2004 ATiwari03-03-2004 requested a review from a team as a code owner December 25, 2025 10:59
Copilot AI review requested due to automatic review settings December 25, 2025 10:59
@vercel
Copy link

vercel bot commented Dec 25, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
nodejs-org Ready Ready Preview Dec 25, 2025 11:00am

@github-actions
Copy link
Contributor

👋 Codeowner Review Request

The following codeowners have been identified for the changed files:

Team reviewers: @nodejs/nodejs-website

Please review the changes when you have a chance. Thank you! 🙏

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a variable height issue in code blocks by applying a fixed height of 19rem to code blocks within active tabs. The fix targets the BaseCodeBox component when rendered inside tabs with an active state.

  • Introduces a fixed height constraint for code blocks in active tabs
  • Uses CSS selector targeting div[data-state='active'] to scope the height change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +80 to +82
div[data-state='active'] .root pre {
height: 19rem;
}
Copy link

Copilot AI Dec 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CSS selector is overly broad and may cause unintended side effects. It targets any div with data-state='active' followed by any descendant with class 'root' and a pre element. This could affect other components in the codebase that use similar patterns. Consider using a more specific selector by adding a unique class to the CodeTabs or Tabs component wrapper, or scope this selector to be more specific to the BaseCodeBox component within a tabs context.

Copilot uses AI. Check for mistakes.
}

div[data-state='active'] .root pre {
height: 19rem;
Copy link

Copilot AI Dec 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fixed height of 19rem (304px) is a magic number without documentation or explanation. Consider extracting this value to a CSS custom property (CSS variable) with a descriptive name, or adding a comment explaining why this specific height was chosen. Additionally, this fixed height may cause issues on different screen sizes or with varying amounts of code content. Consider whether overflow-y: auto should be added to handle cases where content exceeds the fixed height, or whether a max-height with min-content behavior would be more appropriate.

Copilot uses AI. Check for mistakes.
@apply size-4;
}

div[data-state='active'] .root pre {
Copy link

Copilot AI Dec 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting a fixed height on the pre element without overflow-y handling will cause content that exceeds 19rem to be cut off and inaccessible to users. The existing overflow-x-auto is on the nested code element (line 19), not the pre element. Consider adding overflow-y-auto to this rule to ensure users can scroll through longer code blocks, or verify that all code content in active tabs will always fit within 19rem.

Suggested change
div[data-state='active'] .root pre {
div[data-state='active'] .root pre {
@apply overflow-y-auto;

Copilot uses AI. Check for mistakes.
Copy link
Member

@avivkeller avivkeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we just need to make all the code boxes the same height, without CSS changes?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Suggestion] Expand the streams pipeline example to prevent the screen from flickering

2 participants