Skip to content

fix(files): keep Markdown tables readable while scrolling - #10041

Open
waleedlatif1 wants to merge 1 commit into
stagingfrom
codex/markdown-file-viewer-overflow
Open

waleedlatif1 wants to merge 1 commit into
stagingfrom
codex/markdown-file-viewer-overflow

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Let Markdown tables size columns to their content and scroll independently of the reading column.
  • Keep collaborator names visible and reposition floating tools when their controls resize or a table scrolls.
  • Add a real-app Markdown browser suite covering wide tables, long values, code, alignment, images, Mermaid, source preservation, saving, and collaboration.

Type of Change

  • Bug fix

Testing

  • Markdown browser E2E: 58 checks across Chromium/WebKit, public and editable views, light/dark themes, and 320/390/768/1440px widths.
  • Five isolated CSS negative controls reproduce collapsed columns, missing scroll, unbounded cells, and clipped collaborator labels; the original toolbar also fails the viewport check.
  • 716 focused editor tests; root test suite, lint, type-check, all 62 audits, and the block-registry check.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Nov 14, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 14, 2026 6:40am UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2 issues found across 7 files

Confidence score: 3/5

  • test-markdown-viewer-e2e.ts is not wired into a package command or the HTTP E2E workflow, so its Markdown layout checks will not run in CI. Add a suite command and invoke it from the workflow.
  • use-bubble-menu-floating.ts can leave the menu hidden after scrolling back because later scroll callbacks are ignored. Keep a recovery path so the menu can be repositioned and shown again.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/sim/scripts/test-markdown-viewer-e2e.ts">

<violation number="1" location="apps/sim/scripts/test-markdown-viewer-e2e.ts:13">
P2: This new browser suite is not wired into a package command or the HTTP E2E workflow, so the Markdown layout regressions it covers will not run in CI. Add a suite command and invoke it from the E2E workflow with its loopback app, database, auth, realtime, and artifact configuration.</violation>
</file>

<file name="apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/menus/use-bubble-menu-floating.ts">

<violation number="1" location="apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/menus/use-bubble-menu-floating.ts:63">
P2: The visibility guard can permanently suppress recovery: after Tiptap hides the menu when the selection leaves a clipping ancestor, subsequent scroll callbacks are ignored, so scrolling back cannot reposition and show the toolbar. Dispatch the position update whenever the connected menu and editor are alive, regardless of its current visibility.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

import postgres from 'postgres'

/**
* Browser layout and persistence proof against a disposable local app and database.

@cubic-dev-ai cubic-dev-ai Bot Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: This new browser suite is not wired into a package command or the HTTP E2E workflow, so the Markdown layout regressions it covers will not run in CI. Add a suite command and invoke it from the E2E workflow with its loopback app, database, auth, realtime, and artifact configuration.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/sim/scripts/test-markdown-viewer-e2e.ts, line 13:

<comment>This new browser suite is not wired into a package command or the HTTP E2E workflow, so the Markdown layout regressions it covers will not run in CI. Add a suite command and invoke it from the E2E workflow with its loopback app, database, auth, realtime, and artifact configuration.</comment>

<file context>
@@ -0,0 +1,511 @@
+import postgres from 'postgres'
+
+/**
+ * Browser layout and persistence proof against a disposable local app and database.
+ * Set MARKDOWN_VIEWER_E2E_BASE_URL, MARKDOWN_VIEWER_E2E_DATABASE_URL,
+ * MARKDOWN_VIEWER_E2E_AUTH_SECRET, and MARKDOWN_VIEWER_E2E_REPORT_PATH.
</file context>
Fix with cubic

const { node } = editor.view.domAtPos(editor.state.selection.from)
const reference = node instanceof Element ? node : (node.parentElement ?? editor.view.dom)
stop = autoUpdate(reference, menu, () => {
if (!editor.isDestroyed && menu.isConnected && menu.style.visibility !== 'hidden') {

@cubic-dev-ai cubic-dev-ai Bot Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: The visibility guard can permanently suppress recovery: after Tiptap hides the menu when the selection leaves a clipping ancestor, subsequent scroll callbacks are ignored, so scrolling back cannot reposition and show the toolbar. Dispatch the position update whenever the connected menu and editor are alive, regardless of its current visibility.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/menus/use-bubble-menu-floating.ts, line 63:

<comment>The visibility guard can permanently suppress recovery: after Tiptap hides the menu when the selection leaves a clipping ancestor, subsequent scroll callbacks are ignored, so scrolling back cannot reposition and show the toolbar. Dispatch the position update whenever the connected menu and editor are alive, regardless of its current visibility.</comment>

<file context>
@@ -35,21 +36,42 @@ function selectionVirtualElement(editor: Editor) {
+      const { node } = editor.view.domAtPos(editor.state.selection.from)
+      const reference = node instanceof Element ? node : (node.parentElement ?? editor.view.dom)
+      stop = autoUpdate(reference, menu, () => {
+        if (!editor.isDestroyed && menu.isConnected && menu.style.visibility !== 'hidden') {
+          editor.commands.setMeta(pluginKey, 'updatePosition')
+        }
</file context>
Suggested change
if (!editor.isDestroyed && menu.isConnected && menu.style.visibility !== 'hidden') {
if (!editor.isDestroyed && menu.isConnected) {
Fix with cubic

@greptile-apps

greptile-apps Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect how people read and edit Markdown files across public and editable views.

The PR appears safe to merge, with non-blocking follow-ups for collaborator names and toolbar test coverage.

Findings

  1. P2 Scrolling clips collaborator names ▶
  2. P2 Toolbar updates go untested ▶

Summary

This PR gives Markdown tables their own sideways scroll area and updates floating tools when their position or size changes.

  • Wide Markdown tables scroll inside the reading column.
  • Text and table toolbars follow their selections as the view changes.

Reviews (1) · Last reviewed commit: "fix(files): keep Markdown tables readabl..." · Reviewed by Greptile

Comment on lines +382 to +385
.rich-markdown-nodes .tableWrapper {
max-width: 100%;
overflow-x: auto;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Scrolling clips collaborator names

A collaborator name can be clipped after the user scrolls a wide table. activateCaretLabel chooses the label’s direction only when the peer moves. A label that flipped left near the right edge keeps pointing left when scrolling moves its caret near the left edge, outside the new scroll box. Update the label’s direction on table scroll and keep it within the wrapper’s visible bounds.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +309 to +310
await last.click()
await proveToolbar(page, page.getByRole('toolbar', { name: 'Table editing' }))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Toolbar updates go untested

The new browser suite never checks the two events that autoUpdate was added to handle. editLastCell scrolls the table before opening the toolbar, and proveToolbar checks only its current position. No check scrolls with the toolbar open or changes its controls, such as opening the link editor. Add those actions and assert the toolbar’s position afterward so removing the new observer makes the suite fail.

This branch was previously deployed

1 inactive deployment
Preview — b2898da0 Deployed Nov 14, 2026 by vercel[bot]
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.

1 participant