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

List: allow to splice while preserving the view state #44179

Closed
bpasero opened this issue Feb 22, 2018 · 3 comments
Closed

List: allow to splice while preserving the view state #44179

bpasero opened this issue Feb 22, 2018 · 3 comments
Assignees
Labels
feature-request Request for new features or functionality list-widget List widget issues verification-needed Verification of issue is requested verified Verification succeeded workbench-notifications Notification widget issues
Milestone

Comments

@bpasero
Copy link
Member

bpasero commented Feb 22, 2018

It would be nice if the list widget could provide methods so that I can splice elements but preserve the vertical scroll position.

For notifications I would like to preserve the view state when new notifications are coming in, at least when the user has keyboard focus in the list.

@bpasero bpasero added workbench-notifications Notification widget issues list-widget List widget issues labels Feb 22, 2018
@joaomoreno
Copy link
Member

joaomoreno commented Feb 22, 2018

This already happens today. The "view state" is preserved: the list's scroll top will stay stable as you splice elements.

I believe you want something else: you want to preserve a specific element's viewport position. In order to do that, the list might have to change its own scroll top, effectively changing the view state as you splice.

Is that correct?

If so, since there's already a reveal(index, relativeTop) method, would exposing a getRelativeTop(index) method be enough? This already happens in the tree. You would call that method before splicing to understand where your focused element is, splice the list no matter where, and reset that relative top by calling reveal.

@bpasero
Copy link
Member Author

bpasero commented Feb 22, 2018

@joaomoreno yeah that sounds about right, I can play with that once you add it 👍

@joaomoreno joaomoreno added this to the February 2018 milestone Feb 22, 2018
@joaomoreno joaomoreno added the feature-request Request for new features or functionality label Feb 22, 2018
@bpasero
Copy link
Member Author

bpasero commented Feb 23, 2018

Seems to work nicely 👍

@joaomoreno joaomoreno added the verification-needed Verification of issue is requested label Feb 26, 2018
@bpasero bpasero added the verified Verification succeeded label Feb 27, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Apr 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality list-widget List widget issues verification-needed Verification of issue is requested verified Verification succeeded workbench-notifications Notification widget issues
Projects
None yet
Development

No branches or pull requests

2 participants