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

Scroll focus is lost when adding items dynamically to end of quickpick list #131457

Closed
karrtikr opened this issue Aug 24, 2021 · 14 comments
Closed
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) feature-request Request for new features or functionality quick-pick Quick-pick widget issues
Milestone

Comments

@karrtikr
Copy link
Contributor

karrtikr commented Aug 24, 2021

Hi Python extension dev here 👋

As mentioned in #21372 (comment), I tried attempting to implement dynamic quickpick using the API createQuickPick and then adding elements to the end of the quickpick list doing something like,

quickpick.items = <new item list>;

Although if a user happens to scroll down the list while the list is loading, the scroll focus is reset to the top position every time the quickpick list is edited, even though no active item is present.

interpreterlist

In case an active item is present, the reset position always focuses on the item. I request an API to add elements to the list in such a way that the scroll doesn't loose focus.

cc @jrieken

@gjsjohnmurray
Copy link
Contributor

Maybe related to #109969

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Aug 25, 2021

Yeah this is a tricky one... items is readonly by-design... but I think we need some way to add to the end of the list without refreshing the list.

I'm wondering if we can support .push() on .items with the idea that it doesn't change the cursor top. Or we could call it .append()... or we could do quickpick.appendItem()

What do you think @chrmarti?

@TylerLeonhardt TylerLeonhardt added feature-request Request for new features or functionality quick-pick Quick-pick widget issues labels Aug 25, 2021
@TylerLeonhardt TylerLeonhardt added this to the Backlog milestone Aug 25, 2021
@TylerLeonhardt
Copy link
Member

Also related #76193

@karrtikr
Copy link
Contributor Author

Actually I would also like the functionality to edit the item in place without scroll reset, as visible in the GIF. So just append won't do it.

@chrmarti
Copy link
Contributor

quickpick.insertItems(index, additionalItems) might be similar in complexity to implement as quickpick.appendItem() and a bit more general. It makes sense to consider this together with the other issues (removing and replacing items).

@karrtikr
Copy link
Contributor Author

I have another suggestion I left here 🙂 #109969 (comment)

@TylerLeonhardt
Copy link
Member

The overall fix for this issue is being tracked in: #132068
I just checked in a proposed API built on top of the fix for Core (also checked in today) please give it a go and let me know what you think.

@TylerLeonhardt TylerLeonhardt added the *duplicate Issue identified as a duplicate of another issue(s) label Sep 1, 2021
@karrtikr
Copy link
Contributor Author

karrtikr commented Sep 1, 2021

Nice, can I somehow download the Insiders now? Or do I have to wait for tomorrow's Insider release?

@TylerLeonhardt
Copy link
Member

@karrtikr you can run from sources or wait for tomorrow's insider release

@karrtikr
Copy link
Contributor Author

karrtikr commented Sep 7, 2021

API works great. Only downside I see is that the scroll focus is not maintained when elements are deleted in the middle of the list, i.e the visible items change.

@TylerLeonhardt
Copy link
Member

@karrtikr curious what you see... Does it jump up to the top? A gif/video would be ideal.

@karrtikr
Copy link
Contributor Author

karrtikr commented Sep 8, 2021

It doesn't jump to the top, it just shifts a bit. I'll see if I can get the GIF.

@karrtikr
Copy link
Contributor Author

karrtikr commented Sep 8, 2021

I have a list which populates after I click the refresh button. I scroll to the middle of the list and slowly start deleting items at random over a course of 30 seconds, this is what I see:

interpreterlistshift

I guess it's expected since there is no way for VSCode to know if these are new items everytime I assign quickpick.items.

@TylerLeonhardt
Copy link
Member

Yep I agree. Thanks for sharing!

@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) feature-request Request for new features or functionality quick-pick Quick-pick widget issues
Projects
None yet
Development

No branches or pull requests

4 participants