Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust scroll behavior when elements resize #193530

Closed
wants to merge 12 commits into from
Closed

Conversation

amunger
Copy link
Contributor

@amunger amunger commented Sep 19, 2023

fix #193231
fix #193835

The previous behavior changed depending on whether the resizing element was only partially visible.
This will drop that variability and instead, just prevent the resizing element from leaving the view entirely.

@amunger
Copy link
Contributor Author

amunger commented Sep 20, 2023

@joaomoreno - could you take a look at the change to listview.updateElementHeight here? I don't think there's a better way to manually adjust the scroll top at the same time that an element is resized, but I'm open to suggestions.

@amunger amunger marked this pull request as ready for review September 20, 2023 23:01
@vscodenpa vscodenpa added this to the September 2023 milestone Sep 20, 2023
@@ -498,7 +498,7 @@ export class ListView<T> implements IListView<T> {
this.scrollableElement.delegateVerticalScrollbarPointerDown(browserEvent);
}

updateElementHeight(index: number, size: number | undefined, anchorIndex: number | null): void {
updateElementHeight(index: number, size: number | undefined, anchorIndex: number | null, renderTopOverride?: number | undefined): void {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not a huge fan of conflating view model operations (updateElementHeight) with view properties (renderTopOverride). Did you find any other way to solve this?

Copy link
Member

Choose a reason for hiding this comment

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

In other words, would there be a better default other than Math.max(0, this.lastRenderTop + heightDiff) that would fix this issue and play nicely with all other lists?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This new behavior will keep the last line in view, and knowing the amount of padding to be able to do that is pretty specific to the type of items in the list, so it would not be straight forward for the listview to take care of this.

Updating element height seems pretty tightly coupled with rendering at a specific render top in the current implementation, but I could look at other options for adjusting those two pieces separately, (like adding the renderTopOverride to rerender?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I pushed a commit with an alternative, keeping the scrolltop calculations within the updateElementHeight method. I can clean up the parameters a bit more.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rebornix suggested that we go the other way, and make users of updateElementHeight calculate and pass in a render top override if needed. That will simplify listView's updateElementHeight implementation and should allow more explicit control to the users of that function, so I like that idea

@joaomoreno joaomoreno added the under-discussion Issue is under discussion for relevance, priority, approach label Sep 22, 2023
@joaomoreno joaomoreno removed this from the September 2023 milestone Sep 22, 2023
@amunger
Copy link
Contributor Author

amunger commented Sep 22, 2023

with #193833 to take care of the inconsistent anchor behavior, this will take care of #193835 instead, which is not as impactful

@joaomoreno
Copy link
Member

Holding off review until #193231 is stabilized.

@amunger
Copy link
Contributor Author

amunger commented Oct 18, 2023

closing this for now after the improvements from #194516.
We'll see if we get any feedback that makes us revisit.

@amunger amunger closed this Oct 18, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
under-discussion Issue is under discussion for relevance, priority, approach
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Executing cell can resize itself out of view notebook scrolls up incorrectly when adjusting output heights
3 participants