Skip to content

fix(web): wide markdown tables scroll internally and break out on desktop - #1577

Merged
wbxl2000 merged 4 commits into
mainfrom
fix/web-wide-table-scroll
Jul 12, 2026
Merged

fix(web): wide markdown tables scroll internally and break out on desktop#1577
wbxl2000 merged 4 commits into
mainfrom
fix/web-wide-table-scroll

Conversation

@wbxl2000

Copy link
Copy Markdown
Collaborator

Related Issue

None — the problem is explained below.

Problem

Wide markdown tables in the web chat were squeezed into the 760px reading column: many-column tables were compressed into unreadably narrow cells, and there was no good way to view them. On desktop the reading column is also narrower than typical data tables need, and simply letting a table break out would collide with the conversation outline (TOC) that sits beside the message stream.

What changed

Stage 1 (first commit): wide tables scroll horizontally inside their own wrapper — the wrapper stays pinned to the message width with overflow-x: auto, while the table keeps its natural content width. The chat pane and the page never scroll sideways.

Stage 2 (second commit), built on top of stage 1:

  • On desktop, a wide table grows naturally beyond the 760px reading column up to the new --p-table-max: 1040px token, centred within the conversation pane via a container query on the existing .con inline-size container; anything wider keeps scrolling inside the table wrapper. Narrow tables still fill exactly the reading column, and the wrapper is capped by 100cqi so it shrinks automatically when the sidebar or preview resizes. No ResizeObserver / JS sizing is involved.
  • markstream's content-visibility: auto is disabled only for renderers that actually contain a table, so paint containment cannot clip a table that breaks out.
  • The TOC rail keeps its usual position just outside the reading column. A RAF-throttled hit-test in ConversationPane (document.elementsFromPoint at the fixed .toc-bar, accepted only when a .table-node-wrapper inside this pane covers it) hides the TOC only while a table actually passes under the rail, and restores it when the table scrolls away. The hit-test is scheduled from the existing scroll handler, MutationObserver, ResizeObserver, and rebind path — no new observers, no table enumeration. The user's TOC setting is never touched and nothing is written to localStorage.
  • Mobile, SideChat, code blocks, Mermaid, tool cards, and the composer keep their existing width behavior; the markdown parser and markstream-vue are untouched.
  • Design-system view updated: --p-table-max token, wide-table rules, and the TOC occlusion behavior.

Verification: pnpm --filter @moonshot-ai/kimi-web typecheck, check:style, build, and git diff --check all pass. Runtime acceptance (narrow/medium/20+-column tables, TOC hide/restore, sidebar/preview resize, streaming tables, mobile) is manual in the browser; this package has no component-test harness.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Jul 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e000e33

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 12, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@e000e33
npx https://pkg.pr.new/@moonshot-ai/kimi-code@e000e33

commit: e000e33

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 39415666dd

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

const barRect = bar.getBoundingClientRect();
const tocRect = toc.getBoundingClientRect();
const x = barRect.left + barRect.width / 2;
const y = tocRect.top + tocRect.height / 2;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Sample the full TOC rail for table overlap

When the outline has several entries and a short wide table scrolls under only the top or bottom part of the rail, this single midpoint hit-test stays false until the table reaches the rail center. During that interval the visible TOC rows/hover bridge still sit above the table and can intercept clicks, text selection, or horizontal scrolling on the overlapped portion, which defeats the occlusion behavior this code adds; check the rail/row area rather than only tocRect's center.

Useful? React with 👍 / 👎.

@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: e000e339f6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@wbxl2000
wbxl2000 merged commit 6fc1deb into main Jul 12, 2026
10 checks passed
@wbxl2000
wbxl2000 deleted the fix/web-wide-table-scroll branch July 12, 2026 12:08
@github-actions github-actions Bot mentioned this pull request Jul 12, 2026
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