diff options
| author | Adam <[email protected]> | 2026-02-17 10:29:35 -0600 |
|---|---|---|
| committer | Adam <[email protected]> | 2026-02-17 12:57:40 -0600 |
| commit | 3a505b2691f956f4d11e167fe30096e346ad28ae (patch) | |
| tree | 359d98340d8b5051aeb256b6f723d7379f2fc16b | |
| parent | 20f43372f6714803246d50c08a60723469418f3a (diff) | |
| download | opencode-3a505b2691f956f4d11e167fe30096e346ad28ae.tar.gz opencode-3a505b2691f956f4d11e167fe30096e346ad28ae.zip | |
fix(app): virtualizer getting wrong scroll root
| -rw-r--r-- | packages/ui/src/pierre/virtualizer.ts | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/packages/ui/src/pierre/virtualizer.ts b/packages/ui/src/pierre/virtualizer.ts index 4957afc12..42c3a4ca3 100644 --- a/packages/ui/src/pierre/virtualizer.ts +++ b/packages/ui/src/pierre/virtualizer.ts @@ -19,12 +19,35 @@ export const virtualMetrics: Partial<VirtualFileMetrics> = { fileGap: 0, } +function scrollable(value: string) { + return value === "auto" || value === "scroll" || value === "overlay" +} + +function scrollRoot(container: HTMLElement) { + let node = container.parentElement + while (node) { + const style = getComputedStyle(node) + if (scrollable(style.overflowY)) return node + node = node.parentElement + } +} + function target(container: HTMLElement): Target | undefined { if (typeof document === "undefined") return - const root = container.closest("[data-component='session-review']") - if (root instanceof HTMLElement) { - const content = root.querySelector("[data-slot='session-review-container']") + const review = container.closest("[data-component='session-review']") + if (review instanceof HTMLElement) { + const content = review.querySelector("[data-slot='session-review-container']") + return { + key: review, + root: review, + content: content instanceof HTMLElement ? content : undefined, + } + } + + const root = scrollRoot(container) + if (root) { + const content = root.querySelector("[role='log']") return { key: root, root, |
