-
-
Notifications
You must be signed in to change notification settings - Fork 519
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
Make Column scroll position usefull #6083
Comments
Thanks for sharing this! I think So, to add to your proposal, I imagine:
For reference, this might be helpful to understand the internals if you're contributing a PR! (I think working internally on the models is much simpler than working externally; the children are directly accessible thru the model rather than using querySelector & etc) Also, happy to answer questions you may have on the way! |
Thanks for your feedback. With your proposal (which is better than mines), it means we would need to sync the I would guess checking which child has the closest, strictly smaller Something along the line of adding the line set_scroll_index(): void {
this.model.scroll_index= Math.round(<finding index of first child with top directly smaller than column top>);
} What do you think? |
Yes I believe that could work! |
Although still relevant for pn.Column, this issue is linked to a list of ChatMessage, so before I would start working on pn.Column which is then not use for other ListLike (like ChatFeed), I would like your feedback to my latest message, @ahuang11 : |
Is your feature request related to a problem? Please describe.
I find the
scroll_position
parameter to be only useful for setting it to 0, but not for jumping to a specific area. I naively thought the integer represented the index of the listed objects, but it corresponds to thescrollTop
property.I want a method to programmatically jump to an element of the list.
In general, I believe it can be usefull for other subclass of
ListPanel
, likeChatFeed
, as long as a scroll bar may appear.Describe the solution you'd like
I can see two very different approaches with pros and cons:
focus
method on python side which does the same asHTMLElement.focus({ preventScroll: false })
. Then it's not about modifyingListPanel
but about adding this method to all Viewable objects.Describe alternatives you've considered
.focus()
method. However it doesn't work anymore in Panel 1.scrollHeight
. Then just estimating where I should be at. It's not accurate..shadowRoot.children[X].focus()
, however I have no idea how to get childX
.Additional context
I'm willing to work on a PR if given a direction either among my two approaches or a third one I have missed.
The text was updated successfully, but these errors were encountered: