-
-
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
Prevent node rename shortcut from stealing focus from controls #93165
Prevent node rename shortcut from stealing focus from controls #93165
Conversation
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 is something that has been a huge pain for quite some time. I haven't tested it but code looks good.
The bug only occurs, because the default shortcut uses Enter. You can reproduce it on other systems if you manually assign Enter shortcut for renaming or other action. I wonder if other docks are affected too (considering non-default shortcuts). I think instead of checking for Range you could add |
Nope, no other dock reacts to enter like this
Seems reasonable |
0145d66
to
b8a25b4
Compare
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 makes SceneTree shortcuts unusable when a Button is focused. Not sure if it's a problem though, as editor viewports can steal focus very easily so it shouldn't be noticeable.
b8a25b4
to
09f967b
Compare
Now only the rename shortcut is prevented if a button is focused |
_tool_selected(TOOL_RENAME); | ||
// Prevent renaming if a button is focused | ||
// to avoid conflict with Enter shortcut on macOS | ||
if (!focus_owner || !Object::cast_to<BaseButton>(focus_owner)) { |
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.
That's... very specific 🙃
The issue only exists because of a default shortcut. Shortcuts are rebindable, so it doesn't solve all problems.
But eh, technically it fixes the linked issue.
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.
It is very specific and the code is not as pretty :). But previous code didn't make sense though... Blocking all shortcuts seems excessive, even if it's a rare encounter it doesn't feel good if nothing happens when you press a shortcut. If user rebinds to conflicting shortcuts it's a different story I think
Thanks! |
Adds a check for controls that may react to
Enter
to prevent a conflict on macOS. Fixes #88102