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 issue with Focus call crashing #1903
Conversation
I propose the former. Also, disabling the ability to focus an out-of-tree object was a conscious decision and therefore not an accident. I just did not think that this “feature” would be in use.
As soon as a developer has added the object to the content tree, it can be focused. I still cannot see where this is a problem. |
c.contentFocusMgr = app.NewFocusManager(c.content) | ||
if focused != nil { | ||
c.contentFocusMgr.Focus(focused) |
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.
Reasonable feature, but where is the test?
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.
Also, This could be a different PR :).
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.
Test added
We have discussed this many times now - a complex app probably does not want to expose a widget reference all the way up the tree when creating and/or add a new "you're added" callback for main to call. Let me propose another example (beyond what the original bug reporter showed us). |
In the future we need to get better at documenting the intentional breaks - it would have been ideal to include this in the upgrade notes so it does not surprise more people. |
Understood. Seems we need some elegant solution without pitfalls for this. |
Agreed. |
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.
Almost there :).
Co-authored-by: Tilo Prütz <tilo@pruetz.net>
Remove crash when calling Focus before canvas is visible.
Also fix issue where item focused before visible was not remembered (worked < 2.0.0).
Fixes #1893
Checklist: