Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Nov 9, 2025

Add highlighted and comment props to File and Folder components

This PR adds two new optional props to the File and Folder MDX components:

  • highlighted?: boolean - Visually emphasizes files/folders with an accent background
  • comment?: string - Displays explanatory text adjacent to the file/folder name with code-style formatting

Additionally implements several layout and interaction improvements based on iterative feedback.

What was the motivation & context behind this PR?

Users requested the ability to highlight specific files/folders and add explanatory comments in documentation, similar to how code blocks support line highlighting and inline comments. This enhances the ability to draw attention to important files and provide context directly in file tree visualizations.

Implementation details

New props:

  • highlighted - Uses bg-(color:--accent-a4) for background color (updated from bg-[var(--accent-a4)] to match codebase conventions), with data-highlighted attribute for styling hooks
  • comment - Auto-prefixed with "# " if not already present, styled with monospace font and muted gray color (text-(color:--grayscale-a9))

Layout changes:

  • Restructured to nested flex containers for better content flow and wrapping
  • Icons wrapped in 20px tall divs (h-5) with flex centering for consistent alignment
  • Title and comment wrapped in inner flex div with flex-wrap and items-baseline for multi-line support
  • Outer container changed from items-center to items-start for proper multi-line alignment
  • Added break-words utility for long text handling
  • Nested indentation increased from 8px to 16px margin (ml-2ml-4)

Interaction improvements:

  • Folder: Entire row is clickable to expand/collapse (onClick on outer div)
  • Folder: Title link remains the primary action (uses stopPropagation to prevent toggle when clicked)
  • Folder: Chevron button uses stopPropagation to prevent double toggles
  • Folder: Chevron explicitly sized to 24px × 24px with flex centering
  • Links: Underline always visible when href exists (both mobile and desktop)
  • Added cursor-pointer to Folder rows to indicate clickability
  • Added no-underline to File outer anchor to prevent underline propagation to comment

How has this PR been tested?

  • ✅ Linters pass (biome check)
  • ✅ CI checks pass (16 pass, 5 skipping, 0 fail)
  • ⚠️ Visual testing needed: Changes require manual verification in a running docs instance

What should reviewers focus on?

⚠️ Critical items to test:

  1. Folder interaction patterns:

    • Click chevron → should toggle
    • Click title link (when href exists) → should navigate WITHOUT toggling
    • Click comment or blank space → should toggle
    • Verify no double-toggles occur with rapid clicking
    • Test keyboard navigation (Tab to chevron, Space/Enter to toggle)
  2. Text wrapping behavior:

    • Test with very long file names (100+ characters, with and without spaces)
    • Test with very long comments
    • Test with both long name AND long comment together
    • Verify wrapping looks visually acceptable and doesn't break layout
    • Check that break-words utility exists and works
  3. Icon alignment:

    • Verify file icons align properly with folder icons at all nesting levels
    • Check that icons stay aligned with first line of text when content wraps
    • Test with deeply nested folders (3-4 levels)
  4. Underline visibility:

    • Verify underline always shows for links (not just on hover)
    • Check that underline only applies to title, not comment
    • Test on both desktop and mobile devices
  5. CSS compatibility:

    • Verify bg-(color:--accent-a4) renders correctly (custom Tailwind token syntax)
    • Check that highlighted background matches code block line highlighting
    • Verify comment color matches code block comments
  6. Edge cases:

    • Extremely long tokens without spaces (e.g., long URLs)
    • Narrow containers (mobile viewport)
    • Folders with many nested levels

Known risks:

  • Complex event propagation logic with multiple stopPropagation calls
  • No truncation could cause layout issues with extremely long content
  • Multiple iterations on underline behavior based on feedback - final state needs visual verification
  • Known limitation: Entire row is clickable with mouse but only chevron is keyboard-accessible

Link to Devin run: https://app.devin.ai/sessions/f32f9e0085974d17af5201045de6a0cb
Requested by: Colton Berry (@coltondotio)
Feedback from: Kapil (@kapilsinha)

- Add optional highlighted prop to visually emphasize files/folders with accent background
- Add optional comment prop to display explanatory text with code-style formatting
- Implement grid layout for proper icon alignment (file icons now align with folder icons)
- Use bg-(color:--accent-a4) for highlighting to match code block line highlighting
- Use text-(color:--grayscale-a9) for comments to match code block comment styling
- Auto-prefix comments with '# ' if not already present
- Add data-highlighted attribute for styling hooks
- Maintain accessibility structure from PR #4926 (no nested interactive elements)

Co-Authored-By: Colton Berry <[email protected]>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@vercel
Copy link
Contributor

vercel bot commented Nov 9, 2025

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

Project Deployment Preview Updated (UTC)
dev.ferndocs.com Ready Ready Preview Nov 11, 2025 1:03am
fern-dashboard Ready Ready Preview Nov 11, 2025 1:03am
fern-dashboard-dev Ready Ready Preview Nov 11, 2025 1:03am
ferndocs.com Ready Ready Preview Nov 11, 2025 1:03am
preview.ferndocs.com Ready Ready Preview Nov 11, 2025 1:03am
prod-assets.ferndocs.com Ready Ready Preview Nov 11, 2025 1:03am
prod.ferndocs.com Ready Ready Preview Nov 11, 2025 1:03am
1 Skipped Deployment
Project Deployment Preview Updated (UTC)
fern-platform Ignored Ignored Nov 11, 2025 1:03am

@github-actions
Copy link
Contributor

github-actions bot commented Nov 9, 2025

🌱 Smoke Test Preview

Testing branch changes with smoke test content:

🕷️ Smoke Test Crawler Results

Pages crawled: 29
Successful: 29 ✅
With errors: 0

🎉 All pages loaded successfully with no errors!

@github-actions
Copy link
Contributor

github-actions bot commented Nov 9, 2025

🔍 Oculus Evaluation Results

Suite: simple | Run ID: pr-4935-19214151226 | Timestamp: 2025-11-09 20:46:10

Summary

  • Accuracy: 85.0% (34/40 questions correct)

Breakdown by Category

Category Correct Total Accuracy
markdown 34 40 85.0%
📊 View Failed Questions (6)

1. How do I add custom code to my Ruby SDK?

  • Expected: To add custom code to your Ruby SDK, you should refer to the previous documentation at https://buildwithfern\.com/learn/sdks/capabilities/custom\-cod\.\.\.
  • Got: I'll search for information about custom code in Ruby SDKs generated by Fern.Let me search for more specific information about custom code in Ruby ...
  • Reason: [correctness] The AI assistant's answer is incorrect. The ground truth clearly states that the current page is a work in progress and users should refer to the previous documentation at https://bui\.\.\.

2. What are the design principles behind the Fern Ruby SDK?

  • Expected: The documentation for Ruby SDK design principles is currently a work in progress. Users should refer to the previous documentation at https://build\.\.\.
  • Got: I don't have specific information about the design principles behind the Fern Ruby SDK in the documentation. Let me search for more details.Based o...
  • Reason: [correctness] The AI assistant's answer is incorrect because it fails to mention the key information from the ground truth: that the documentation for Ruby SDK design principles is currently a work...

3. How do I embed a YouTube video in my Fern documentation?

  • Expected: To embed a YouTube video in Fern documentation, you should use an `<iframe>` element. Since MDX files use JSX syntax, HTML attributes must be writt...
  • Got: You can embed YouTube videos in your Fern documentation using an HTML `<iframe>` element. Here's how to do it:To embed a YouTube video in your Fern...
  • Reason: [correctness] The AI assistant's answer contains a critical error: it uses lowercase HTML attributes (e.g., "frameborder" and "allowfullscreen") instead of camelCase as required by MDX/JSX syntax. ...

4. How do I configure header-based API versioning in my Fern api.yml file?

  • Expected: To configure header-based API versioning in your Fern api.yml file, you need to add a version section that specifies the header name (such as X-API...
  • Got: To configure header-based API versioning in your Fern OpenAPI definition, you need to use the `x-fern-version` extension. Here's how to do it:Based...
  • Reason: [correctness] The AI assistant's answer is incorrect. The question asks about configuring header-based API versioning in the Fern api.yml file, but the assistant provides instructions for OpenAPI Y...

5. How do I enable product switching for my documentation site and what are the requirements?

  • Expected: Product switching is a Pro and Enterprise feature that allows users to navigate between different products in your documentation. To enable it, you...
  • Got: I'll help you set up product switching for your Fern Docs site.To enable product switching for your Fern Docs site, you need to set up multiple pro...
  • Reason: [correctness] The AI assistant's answer contains a critical omission - it fails to mention that users need to contact [email protected] to get started with this feature, which is a key requ...

6. Which .NET Framework versions are supported by Fern-generated SDKs for Unity development?

  • Expected: Fern-generated .NET SDKs support .NET Framework versions 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, and 4.8.1 for Unity development. Unity typically uses eithe...
  • Got: I'll look up the specific .NET Framework versions supported by Fern-generated SDKs for Unity development.
  • Reason: [correctness] The AI assistant's answer is incorrect because it only states an intention to look up information rather than providing the actual answer. The response "I'll look up the specific .NET...

📎 View full results in workflow artifacts


Tested against: https://prodferndocs-8jy16mqzr-buildwithfern.vercel.app

- Change from grid to flex layout for both components
- Make chevron click target 24px x 24px and center-aligned
- Group icon, name, and comment in inner flex container
- Remove truncation/ellipsis - file names and comments now fully visible
- Increase nested file/folder left padding from pl-2 to pl-4 (16px)
- Keep ml-auto on comments to right-align them

Co-Authored-By: Colton Berry <[email protected]>
- Change nested container from ml-2 pl-4 to ml-4 pl-2
- Remove ml-auto from comment spans in both File and Folder
- Comments now appear right next to file/folder names instead of right-aligned

Co-Authored-By: Colton Berry <[email protected]>
…action

- Add onClick to row div to toggle expand/collapse
- Add stopPropagation to chevron button to prevent double toggles
- Add stopPropagation to title link so navigation takes precedence over toggle
- Add cursor-pointer to row to indicate clickability

Co-Authored-By: Colton Berry <[email protected]>
- Replace hover:underline and [@media(hover:none)]:underline with just underline
- Apply to both File and Folder components
- Underline now always visible when href exists, not just on hover

Co-Authored-By: Colton Berry <[email protected]>
- Change bg-[var(--accent-a4)] to bg-(color:--accent-a4)
- Apply to both File and Folder components
- Matches existing pattern used for other color utilities

Co-Authored-By: Colton Berry <[email protected]>
Co-Authored-By: Colton Berry <[email protected]>
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.

2 participants