Skip to content

fix(mod): scroll the markdown preview - #505

Open
jchen0824 wants to merge 1 commit into
AkaraChen:mainfrom
jchen0824:fix/markdown-preview-scroll
Open

jchen0824 wants to merge 1 commit into
AkaraChen:mainfrom
jchen0824:fix/markdown-preview-scroll

Conversation

@jchen0824

@jchen0824 jchen0824 commented Nov 23, 2026 •

Copy link
Copy Markdown

Problem

In a file tab, a long markdown file couldn't be scrolled in Preview or Split: the rendered text was cut off at the bottom of the tab.

Cause

The preview called overflow_y_scrollbar() on its absolutely positioned box (absolute().inset_0()). overflow_y_scrollbar() wraps its element: Herdr's Scrollable copies the element's size and flex styles to the wrapper, but keeps position and the insets on the element, which becomes the scrolled content. So inset_0 pinned the content to the visible height, and there was nothing to scroll.

Fix

The fix uses the pattern Herdr documents for an absolutely positioned scroll area. The typings for Scrollbar describe it, and it's what 2code's Changes list and Herdr's own Changes panel use:

  • overflow_y_scroll() on the absolute box (md-<id>);
  • the TextView in a flex_none() page, so it keeps its full height;
  • a Scrollbar.vertical("md-<id>") over the box, matched by id.

RECIPE.md gets a Watch out note about overflow_y_scrollbar() on absolute elements.

Checked

  • herdr-app check mods/2code passes.
  • In the running app, a 640-line markdown file scrolls in Preview and Split. Before the fix, it didn't scroll in either.

@netlify

netlify Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

👷 Deploy request for grand-selkie-225f87 pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit fdfdab7

@jchen0824
jchen0824 force-pushed the fix/markdown-preview-scroll branch from 3a3db10 to f347cb3 Compare November 23, 2026 06:13
The preview put overflow_y_scrollbar() on its absolutely positioned box.
That wrapper keeps the box's position and insets on the scrolled content,
so inset_0 pinned the content to the visible height and nothing scrolled:
long markdown files were cut off in Preview and Split.

Use the pattern Herdr documents for an absolute scroll area, as the
Changes list does: overflow_y_scroll() on the box, the TextView in a
flex_none() page at its full height, and a Scrollbar.vertical with the
same id.
@jchen0824
jchen0824 force-pushed the fix/markdown-preview-scroll branch from f347cb3 to fdfdab7 Compare November 23, 2026 11:09
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