Skip to content

fix(ui): scope file viewer CSS so CSV/MD renderers don't affect app l…#1275

Open
dataCenter430 wants to merge 1 commit intoeigent-ai:mainfrom
dataCenter430:fix-global-layout/style-contamination
Open

fix(ui): scope file viewer CSS so CSV/MD renderers don't affect app l…#1275
dataCenter430 wants to merge 1 commit intoeigent-ai:mainfrom
dataCenter430:fix-global-layout/style-contamination

Conversation

@dataCenter430
Copy link

Closes #1264

Related Issue

Switching between file types (e.g. in_progress_tickets.csv and shared_files.md) caused visible typography and layout shifts in the whole interface (sidebar, file list, outer containers). File renderer CSS was affecting the rest of the app.

Root cause

CSV/HTML content: injectFontStyles() injected a <style> with a global * { font-family: ... } selector. That style was rendered in the main document by FolderComponent, so it applied to the entire app. When switching to markdown (different render path), the style disappeared and the UI “snapped” back.
Markdown: github-markdown-css set color-scheme (and variables) on [data-theme="dark"] / [data-theme="light"], which is on the app root, so it influenced the whole app.

Description

htmlFontStyles.ts: For HTML fragments (e.g. CSV), use a scoped selector (.eigent-file-content *) and wrap content in

. Full documents (e.g. HTML in iframe) keep the existing unscoped style.
markdown-styles.css: Override so color-scheme is not set on the theme root; only [data-theme] .markdown-body gets color-scheme.
Folder viewer: Add .file-viewer-content wrapper and, in index.css, use contain: layout style and isolation: isolate so file content styles don’t affect the surrounding app.

Result

File viewer styling is confined to the content area; switching between CSV and markdown (and other file types) no longer changes sidebar or outer layout/typography.

15.02.2026_17.08.21_REC.mp4

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Contribution Guidelines Acknowledgement

@dataCenter430
Copy link
Author

@Wendong-Fan could you plesae review the PR? thx

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.

[Feature Request] Global Layout Shift & Style Contamination when switching file types (CSV vs MD) in agent folder

1 participant