Is there a way to make ScrollView auto-scroll to make a contained VisualElement visible when it receives focus?

I have a ScrollView with a very large list in it that does not renders entirely. I would like the ScrollView to auto-scroll if one of its contained VisualElements receives focus but it is not in the visible part of the ScrollView viewport. Does anyone knows if it can be done automatically or if I have to code it on my own?

I don’t think built in, but all in all it should be simple to code. Can probably by done by registering a call back to a focus event on the scroll view, and then scrolling to the target of the focus.

Best to consult the docs on how each of the focus events work: Unity - Manual: Focus events

1 Like

Hello, have you tried using ScrollTo in your code? Does this work for your case?

[Solved]
I tried the method public void ScrollTo(VisualElement child) from SrcollView but did not work then I switched to a ListView that has an embedded ScrollView and tried the method ScrollTo(VisualElement) but did not work either, then I tried ScrollToItem(Int32) and that worked. Thank you all for your suggestions.