# markdown: Add horizontal scrollbars to wide tables \(\#61745\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/51db7df7501e672fdfc9fa4875f43215329fc0d9)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 51db7df7501e672fdfc9fa4875f43215329fc0d9

Requested commit: 51db7df7501e672fdfc9fa4875f43215329fc0d9

Commit: 51db7df7501e672fdfc9fa4875f43215329fc0d9

Tree: 7a2a56a5a98a3078a5777495c9c56fcb8bc14764

Author: JC Diamante

Committer: GitHub

## Message

```
markdown: Add horizontal scrollbars to wide tables (#61745)

## Objective

Add functional horizontal scrollbars to wide Markdown tables, matching
the existing code-block scrollbar pattern.

Fixes #61437

PR was talked about in https://github.com/zed-industries/zed/pull/61698

## Implementation:
- Added a `BTreeMap<usize, ScrollHandle>` to `Markdown` for table scroll
handles, keyed by source-range start.
- During `MarkdownElement` layout, each table container is connected to
a `Scrollbars` widget configured for the horizontal axis, using a stable
ID derived from `("markdown-table-scrollbar", range.start)`.
- The inner table div uses `overflow_x_scroll()` + `track_scroll()` with
`restrict_scroll_to_axis`.
- Handles for removed tables are discarded after re-rendering.
- No public API, setting, schema, or migration changes required.

## Recording


https://github.com/user-attachments/assets/cd0f635b-a485-4de8-9059-40a05f256fb1

## Release Notes:

- Improved navigation of wide Markdown tables with horizontal
scrollbars.

---------

Co-authored-by: MrSubidubi <finn@zed.dev>
```

## Parents

- [d0f797a38c751cff745108e458bbc5ec73c70738](https://git.cafe/gitcafe/zed/commit/d0f797a38c751cff745108e458bbc5ec73c70738?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/51db7df7501e672fdfc9fa4875f43215329fc0d9?format=markdown)
