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

Can't change focus to off-screen Control nodes in ScrollContainers by using the arrows. #103726

Open
NandoBroquiGames opened this issue Mar 6, 2025 · 6 comments · May be fixed by #104017
Open

Comments

@NandoBroquiGames
Copy link

NandoBroquiGames commented Mar 6, 2025

Tested versions

  • Reproducible in Godot v4.4.stable
  • Not reproducible in Godot v4.3.stable

System information

Godot v4.4.stable - Windows 11 (build 26100) - Multi-window, 1 monitor - OpenGL 3 (Compatibility) - NVIDIA GeForce RTX 2060 (NVIDIA; 32.0.15.6636) - Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz (12 threads)

Issue description

With this new Godot 4 release, it isn't possible anymore to change focus to controls that are off the scroll container screen. While this is actually solvable by toggling the follow_focus property, it actually is affecting my game's code and might be affecting other's.

Image

Take for example to above image of one of my game's scenes, the scroll container is built that way so I can code smooth animations from where changing to the other level containers and center them. This bug makes now the player unnable to use the left arrow to go back, but that weirdly works by using shift+tab (AKA, previous).

Below is a camera recording with my phone of pointing out the issue:

8mb.video-uag-227zR6mX.mp4

Steps to reproduce

  • Create a new Godot project;
  • Create a Control scene;
  • Add a Scroll Container;
  • Add a VBox to the Scroll;
  • Attach nodes that will go off the Scroll Container area (we'll use buttons for this example);
  • Add a script to the scene;
  • Make so, in the ready function, one of the buttons (by preference one that's in the Scroll) grab the focus;
  • Run the project and try changing focus to the buttons off the Scroll Containers by using the arrows.
  • (Bonus: test it with the next and previous actions (tab and shift+tab, respectively), you'll notice now it will work instead of the arrows.

Minimal reproduction project (MRP)

Here's the small repro-project I used to replicate the issue:

offscreencontrolneighborfocus_2025-03-06_17-55-38.zip

@Alex2782
Copy link
Member

Alex2782 commented Mar 8, 2025

With this new Godot 4 release, it isn't possible anymore to change focus to controls

Seems to be a regression, which version last worked?

@NandoBroquiGames
Copy link
Author

NandoBroquiGames commented Mar 8, 2025

With this new Godot 4 release, it isn't possible anymore to change focus to controls

Seems to be a regression, which version last worked?

Damn... It worked fine on Godot 4.3, I don't test the dev / unstable versions, so Idk...

Edit: does the 4.5 milestone means that will only be fixed on 4.5? Or there will be a 4.4.x version to fix it?

@Alex2782 Alex2782 moved this from Unassessed to Bad in 4.x Release Blockers Mar 8, 2025
@Alex2782
Copy link
Member

Alex2782 commented Mar 8, 2025

Edit: does the 4.5 milestone means that will only be fixed on 4.5? Or there will be a 4.4.x version to fix it?

I have seen a similar question here before:
#102998 (comment)
(or the approach that should answer your question)

@Rindbee
Copy link
Contributor

Rindbee commented Mar 12, 2025

This is a situation where the ScrollContainer overlaps with external controls, which is not considered in #63059.

@NandoBroquiGames
Copy link
Author

This is a situation where the ScrollContainer overlaps with external controls, which is not considered in #63059.

Wdym external controls? Is there a temporary solution I can do?
And wdym it's not considered?

@Rindbee
Copy link
Contributor

Rindbee commented Mar 12, 2025

Wdym external controls?

Not a descendant control of ScrollContainer. That is, ScrollContainer (sc) is not its (expected control) ancestor (the result of sc.is_ancestor_of(expected) is false).

Is there a temporary solution I can do?

Make their rects non-intersecting:

For MRP, keep the center of the ScrollContainer unchanged, reduce its width; slightly adjust the position of the expected controls. HBoxContainer with theme_override_constants/separation should be able to help.

For your project demo video, the elements are somewhat similar, so it is visually indistinguishable which controls are outside the ScrollContainer.

And wdym it's not considered?

When looking for neighbors outward from the ScrollContainer, some cases are simplified to looking from the border of the ScrollContainer, which ignores this case (it does not need to be repositioned).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Bad
Status: For team assessment
Development

Successfully merging a pull request may close this issue.

4 participants