Auto-scroll hover popup while selecting text (#57518)

Selecting text inside the hover documentation or git popups did not
scroll the popup when the drag passed the visible area, so any text
below the area could not be selected with the mouse.

The popup's container already had a `ScrollHandle` wired to its
scrollbar and wheel scrolling, but the inner `MarkdownElement` was
constructed without one. That left it in the default
`AutoscrollBehavior::Propagate` mode, which routes drag-autoscroll
requests to the editor-wide autoscroll listener, which is a listener
that does not exist inside a floating popover, so the requests were
silently dropped.

Passing the popup's existing `ScrollHandle` into the `MarkdownElement`
switches it to `AutoscrollBehavior::Controlled`, which scrolls the
popup's own container directly during a drag. The markdown preview view
already uses this same pattern.

Release Notes:

- Fixed hover documentation and git popups not scrolling while selecting
text with the mouse

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
This commit is contained in:
Daniel Martín authored and GitHub committed 2026-05-28 09:55:14 +00:00
1 parent 8a6bf0cc3c
commit e43bdbcae0
3 files changed
+11 -2

No files matched your search

+5 -1
View File
@@ -258,7 +258,11 @@ impl Render for CommitTooltip {
.commit
.message
.as_ref()
.map(|_| MarkdownElement::new(self.markdown.clone(), markdown_style).into_any())
.map(|_| {
MarkdownElement::new(self.markdown.clone(), markdown_style)
.scroll_handle(self.scroll_handle.clone())
.into_any()
})
.unwrap_or("<no commit message>".into_any());
let pull_request = self