Scroll Areas

dembrandt/dembrandt-skills/skills/scroll-areas

作者 dembrandt20de5f225ea7cffe2a721ac18c1077a92769a013无许可证收录于 2026年10月9日更新于 2026年10月9日

Avoid inner scroll containers; when unavoidable, one axis at a time. Use when a layout, table or panel might scroll inside the page.

仅含说明Design & Creative
AI 生成的概览

指导界面内部滚动区域的设计决策,主张优先使用页面滚动,并采用单轴、用户可控的滚动。

功能
该技能为布局、表格、面板、弹窗和侧边栏中的内容溢出处理提供设计指导。它建议默认让页面滚动,并列出分页、折叠面板、独立路由和渐进式展示等替代方案。当内部滚动区域确有必要时,它要求只使用一个滚动轴、滚动由用户控制,并提供可见的滚动提示,最后附有审查清单。
适用场景
当布局、表格或面板可能需要在页面内部滚动,或需要判断某个区域是否应独立滚动时使用。它也适用于审查涉及溢出或固定高度的 CSS、组件或设计系统文件。
运行要求
无需任何工具、软件包或凭据;它仅为说明性指令,不附带脚本。

Scroll Areas

Avoid Scroll Areas by Default

Scroll containers inside a layout — panels, drawers, tables, modals with inner overflow — create friction. Users must discover that a region scrolls, manage multiple independent scroll positions simultaneously, and context-switch between scroll areas on the same screen.

Default: let the page scroll. A single page-level scroll is universally understood and requires no discovery. Before introducing an inner scroll area, ask whether the layout can be restructured so the page itself handles the overflow.

Alternatives to inner scroll:

  • Pagination or load-more for long lists
  • Collapsible sections (accordion) for long detail panels
  • A separate page or route for content that would otherwise fill a scroll area
  • Progressive disclosure — show less by default, expand on demand

When a Scroll Area Is Justified

Some layouts genuinely require inner scroll:

  • Fixed-height sidebars with navigation trees longer than the viewport
  • Data tables where the header must remain visible while rows scroll
  • Chat or log panels where the stream is continuous and the surrounding layout is fixed
  • Code editors or terminal panes embedded in a larger application shell

In these cases, proceed — but apply the constraints below.

One Axis Only

Never create a scroll container that scrolls on both axes simultaneously. Two-axis scroll is disorienting, hard to control precisely, and nearly unusable on touch devices.

css
/* One axis: vertical */overflow-y: auto;overflow-x: hidden;
/* One axis: horizontal (e.g. wide table) */overflow-x: auto;overflow-y: hidden;
/* Never */overflow: auto; /* allows both axes */

If content requires both axes — e.g. a wide table inside a constrained panel — restructure the layout so the table's horizontal scroll is the only scroll in the view, with the page itself not scrolling at that point.

Always User-Controlled

Scroll must never happen automatically without user intent. Specifically:

  • No auto-scrolling that moves the viewport without the user initiating it
  • No scroll hijacking — do not intercept the native scroll event to animate or pace it artificially
  • Scroll-to on load is acceptable only when restoring a previous scroll position (e.g. returning to a list after navigating away)
  • Scroll-to for errors or anchors is acceptable as a response to a user action (submitting a form with errors, clicking a table-of-contents link)

Exception: chat and log panels may auto-scroll to the bottom on new content, but only if the user is already at the bottom. If the user has scrolled up to read, do not force them back down — show a "new messages" indicator instead.

Scroll Affordance

Users must be able to tell a region is scrollable before they attempt to scroll it.

  • Clip content visually at the edge — a partially visible item signals "there is more"
  • Use a subtle scrollbar (not scrollbar-width: none) so the track is visible
  • On touch, a partial item at the edge is the primary affordance — ensure the container does not have overflow: hidden on the trailing edge

Review Checklist

  • Is every inner scroll area genuinely necessary, or can the layout be restructured to use page scroll?
  • Does every scroll container scroll on one axis only?
  • Is overflow: auto (two-axis) avoided on all scroll containers?
  • Is scroll always user-initiated — no hijacking, no forced auto-scroll?
  • Is the scrollable region visually apparent (partial content, visible scrollbar)?
  • On touch devices, is scroll smooth and native (-webkit-overflow-scrolling: touch or equivalent)?

来源与署名

来源:dembrandt/dembrandt-skills位于skills/scroll-areas提交20de5f2

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架