Skip to content

desktop: code blocks hide horizontal scrollbars and cannot wrap long lines #60143

Closed

Description

@MercuryOoO

Description

Long single-line code in a fenced block is clipped at the viewport edge. The block scrolls horizontally, but the scrollbar is hidden by CSS:

pre {
  overflow: auto;
  scrollbar-width: none;
  &::-webkit-scrollbar { display: none; }
}

(packages/session-ui/src/components/markdown.css)

On Windows there is no visible affordance. The only ways to reach the rest of the line are Shift+wheel or selecting text and dragging. There is also no wrap option. A code block taller than the viewport loses its copy button while scrolling too (tracked separately in #53519).

This was reported in #49535, but that issue was closed as a v1 issue, not fixed.

Plugins

env-guard.ts, headroom-compress.ts, memory-inject.ts, modelscope-imagegen.ts (none related)

OpenCode version

2.2.1 desktop (bundled CLI 2.2.1), channel latest

Steps to reproduce

  1. Ask the assistant to output a fenced code block with a very long single line (e.g. 2000+ characters).
  2. Look at the right edge of the code block.
  3. No horizontal scrollbar appears; the overflow is only reachable with Shift+wheel or by selecting text and dragging.

Screenshot

No screenshot attached.

Operating System

Windows 11 Pro 10.0.26300 x64

Terminal

Desktop app

Expected Behavior

  • Show a horizontal scrollbar when the block overflows (always, or on hover/focus), and/or
  • Add a "wrap long lines" toggle for code blocks.

The same shared styles affect the web UI, so this is not desktop-only.

Activity

  1. opencodejr commented on Oct 29, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report, and for following up on #49535 on v2.

    You're asking for long lines in code blocks to be reachable without a hidden gesture: a visible horizontal scrollbar when a block overflows (always, or on hover/focus), and/or a "wrap long lines" toggle. The hidden scrollbar comes from deliberate styling in markdown.css rather than a malfunction, so I've filed this as a feature request. Maintainers will consider it.

    Related issues:

    There's no plugin workaround for now, because plugins can't change the desktop or web UI's styles.

  2. wheresvic commented on Oct 30, 2026

    @wheresvic

    I'd like to pick this up. Proposal: a "Wrap long lines in code blocks" toggle in Settings > Appearance, off by default so the current look doesn't change. Same pattern as Reduce motion (#57103): a boolean in the appearance settings, set as an attribute on the root, plus one rule on markdown pre (white-space: pre-wrap; overflow-wrap: anywhere). I've tested the CSS in the dev web UI and it works.

    Separate question: when wrapping is off, would you accept a thin visible scrollbar on blocks that overflow? Fine to leave it out if hiding it is deliberate.

  3. MercuryOoO commented on Nov 1, 2026

    @MercuryOoO
    Author

    2. I'd like to pick this up. Proposal: a "Wrap long lines in code blocks" toggle in Settings > Appearance, off by default so the current look doesn't change. Same pattern as Reduce motion (#57103): a boolean in the appearance settings, set as an attribute on the root, plus one rule on markdown pre (white-space: pre-wrap; overflow-wrap: anywhere). I've tested the CSS in the dev web UI and it works.
    Separate question: when wrapping is off, would you accept a thin visible scrollbar on blocks that overflow? Fine to leave it out if hiding it is deliberate.

    Thanks for picking this up — the Reduce motion pattern (#57103) is a good fit for this.

    I'd like both parts to land together rather than as alternatives:

    1. Wrap toggle: agreed, off by default so the current look doesn't change. Since the styles live in the shared packages/session-ui, one change covers desktop and web. Small ask: make the scrollable pre focusable (tabindex="0") so keyboard users can scroll it when wrapping is off — right now there's no focusable affordance at all.

    2. Visible scrollbar when wrapping is off: yes, please. A thin scrollbar that only appears when the block actually overflows is enough; it doesn't have to be always visible. With it hidden, long lines are only reachable via Shift+wheel or drag-select, and we're seeing the same complaint elsewhere (Bug: Settings & Connect Provider dialogs hide their scrollbar (v2 layout) — Windows and Ubuntu #46680, no scrollbar in settings #56309, [Desktop] Settings > Providers page has no scrollbar and cannot scroll to providers below the visible area #48458), so I'd treat this as an accessibility fix rather than a style preference.

    Notes for the PR:

    A per-code-block wrap toggle next to the copy button would be a nice bonus, but the global setting is the part I care about. Go ahead and open the PR.

  4. wheresvic commented on Nov 1, 2026

    @wheresvic

    Thanks for the notes. Agreed on adding the setting as an optional field with a fallback, checking that overflow-wrap: anywhere behaves inside flex/grid parents, and saying in the PR where #57432 and #53519 stand.

    I'll keep the PR to the wrap toggle, though. A visible scrollbar and tabindex change the default for everyone, so I'd leave those to the maintainers to decide.

    @Brendonovich , could you confirm the toggle approach (off by default, same pattern as Reduce motion in #57103)? I'll build it in my fork meanwhile and open the PR once it's approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions