-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
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
Fix getting wrong focus neighbor when the control is in ScrollContainer #63059
Fix getting wrong focus neighbor when the control is in ScrollContainer #63059
Conversation
d8ea7cb
to
717d59d
Compare
The issue was that when the engine was deciding automatically where the focus neighbour of a control was, it did not take ScrollContainers into account, so controls outside of the container were technically closer in distance to the currently focused control than the controls within the container that were not in view. This has being fixed by checking for ScrollContainers along the way in determining where the 'base' control is in the current scene. If there are no valid neighbours within the container that the focus can move to, the function proceeds as normal, and focus goes outside of the container. This issue has already been reported in Godot, see: godotengine#63055 The fix was based on this PR for the given issue: godotengine#63059
The issue was that when the engine was deciding automatically where the focus neighbour of a control was, it did not take ScrollContainers into account, so controls outside of the container were technically closer in distance to the currently focused control than the controls within the container that were not in view. This has being fixed by checking for ScrollContainers along the way in determining where the 'base' control is in the current scene. If there are no valid neighbours within the container that the focus can move to, the function proceeds as normal, and focus goes outside of the container. This issue has already been reported in Godot, see: godotengine#63055 The fix was based on this PR for the given issue: godotengine#63059
da54ca9
to
81890b0
Compare
c8ef806
to
b94849c
Compare
b94849c
to
3da8582
Compare
This breaks inspector focus. The controls inside inspector can't be navigated with keyboard, focus immediately goes outside. |
Yes, the overlapping case is taken into account, but it does not take into account lowering the priority of the parent container whose |
5011e21
to
cc131c9
Compare
cc131c9
to
af3c8b1
Compare
Regardless of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ties Control with ScrollContainer 🤔
Also it's a change in Control, so might be too risky for 4.4 now.
On the other hand, I think the fix waited long enough. Tested some stuff that could break and it works correctly.
…ner` Exclude controls inside a `ScrollContainer` that are outside the visible area of the `ScrollContainer` when looking for focus neighbors.
af3c8b1
to
e197463
Compare
Sorry, the original code allowed the control to rotate, so using the points array made sense. I ignored the situation. Eidt: Edit 2: |
Since it uses the global rect to find overlapping controls, it will work even when rotated. A bit better than I thought. The algorithm is simpler than using an array of points. It may not be ideal in some corner cases, but in most cases it won't make the situation worse. master: 000.mp4This PR: 001.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ehh, this timing is pushing it, but I think we can let it slide.
Thanks! |
Now, navigating in a
ScrollContainer
withoutfollow_focus
enabled will not navigate to the shadow child control.Then when navigating outside of a
ScrollContainer
, avoid unintended effects on navigation caused by theScrollContainer
withfollow_focus
enabled.Fix #63067, fix #98445.
Works fine whenfollow_focus
is enabled, when not enabled, there is still an issue. See #63067.