Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

fix(app): sticky accordion scroll issue#16408

Closed
neriousy wants to merge 3 commits intoanomalyco:devfrom
neriousy:fix/sticky-accordion-scroll-issue
Closed

fix(app): sticky accordion scroll issue#16408
neriousy wants to merge 3 commits intoanomalyco:devfrom
neriousy:fix/sticky-accordion-scroll-issue

Conversation

@neriousy
Copy link
Contributor

@neriousy neriousy commented Mar 6, 2026

Issue for this PR

Closes #16407

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When closing a sticky accordion proper scroll is maintained

If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!

How did you verify your code works?

Open file diff
Scroll down
Close file diff

Screenshots / recordings

2026-03-07.00-08-01.mp4

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

Copilot AI review requested due to automatic review settings March 6, 2026 23:09
@github-actions github-actions bot added contributor needs:compliance This means the issue will auto-close after 2 hours. labels Mar 6, 2026
@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Mar 6, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a scroll position issue when collapsing sticky accordion sections in the OpenCode app. When a user closes a file diff accordion, the content above collapses and the viewport would jump unexpectedly. The fix introduces a pinSticky utility that captures the accordion header's screen position before toggling, then continuously adjusts scrollTop on the scrollable ancestor using requestAnimationFrame and ResizeObserver to keep the header visually pinned during content collapse animations.

Changes:

  • Introduced a new sticky-accordion.ts module with accordionValue (normalizes accordion value to an array) and pinSticky (maintains scroll position when accordion content collapses)
  • Updated StickyAccordionHeader to accept and forward a ref prop so callers can capture the header DOM element
  • Applied the pinSticky scroll-pinning pattern across session-turn.tsx, session-review.tsx, and message-part.tsx for all accordion toggle interactions

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/ui/src/components/sticky-accordion.ts New utility module with accordionValue normalizer and pinSticky scroll-pinning function
packages/ui/src/components/sticky-accordion-header.tsx Added ref prop support via splitProps to forward header element reference
packages/ui/src/components/session-turn.tsx Added scroll pinning for collapsible and nested accordion toggling of file diffs
packages/ui/src/components/session-review.tsx Added scroll pinning for accordion toggling in the session review panel
packages/ui/src/components/message-part.tsx Added scroll pinning for ToolFileAccordion and apply_patch tool accordion sections

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@neriousy neriousy marked this pull request as draft March 6, 2026 23:17
# Conflicts:
#	packages/ui/src/components/message-part.tsx
#	packages/ui/src/components/session-turn.tsx
@neriousy
Copy link
Contributor Author

neriousy commented Mar 7, 2026

moved to #16510 cause github wont assign adam on non packages/[app/desktop] changes

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hiding file diffs makes scroll behave weirdly (app / desktop)

2 participants