How to make scrollcontainer auto-scroll when internal buttons are focused out of view?

Godot Version



I’m designing a menu function that operates like a traditional system, with one line representing one option.
My node tree looks like this:

└ VBoxContainer
  ├ Button
  └ more buttons...

With the mouse it works fine. However, if I use the keyboard arrow keys to control it, the Scroll doesn’t scroll when I focus on the buttons outside the view.

│button1  │
│button2  │
 button3 <

I looked up related tutorials and Q&A and only found for triggering a scroll to the bottom when adding new node (like chat app). This doesn’t solve my problem, it should only scroll when focusing on options outside the view, not at the max bottom.
Considering there are more than two pages of options. It should only scroll to the position of the specified button

The ScrollContainer has a follow_focus property for that. Make sure it’s checked.