-
-
Notifications
You must be signed in to change notification settings - Fork 666
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
Tab not working when trying to switch between textInputs generated during runtime #2766
Comments
Thanks for the report - I can't think of any reason the behaviour you're reporting would be happening. I'd like to be able to help more, but I can't reproduce the problem, because your reproduction code doesn't reproduce the problem. It might be part of a reproduction case, but it's not complete (it references variables like A working reproduction case is an essential part of any bug report; can I ask you to provide an updated - and complete - reproduction case? |
Hi Russell, Thanks for your answer and your help. Indeed, the quality of the reprod code was not adequate. I have created a new one with relevant code and made sure it works and it reproduces the problem. I've edited the issue description with the updated code. |
Thanks - I can now reproduce the problem you're seeing. I think I understand why it is occurring. Unfortunately, it's a bug, not an error of usage; and I can't point you at an easy cross-platform workaround. The underlying problem is that Cocoa tracks the focus chain as a linked list - each widget has a field You can work around this on a platform-specific basis by reaching into the internals. For example, if you add the following to the end of
This reaches into the native Cocoa widgets backing the Toga widgets, and tells the SheetID that it should point at the input of the first training day; the training day should point at the muscle group; and the muscle group should point back at the program name. You'll need to modify this so that adding the second training day inserts the new widgets into the appropriate spot in the chain, but hopefully the general approach should be clear. I should also note that this code is macOS only, so if you're planning to target any other platform, you'll need to gate this logic with I would imaging that a full implementation of #1650 will likely fix the problem inadvertently, because part of adding a new widget will invoke re-computing the tab index sequence for all other widgets. |
Thanks a lot for the explanation and the suggested workaround, it makes a lot of sense. For the record, @rmartin16 managed to reproduce this issue on Windows and Linux too as per his message on Discord |
Describe the bug
I came across a strange bug while developing my application with Toga under Beeware default layout. When I place textInputs during startup I can use tab to switch between them. But when I use a button to generate more I can no longer switch between the new ones using tab - although I can still tab between the ones originally placed. They are in the same box.
code snippet:
As I enter stuff I would love to use tab to make it easier. It does not seem possible however with generated textinputs.
Steps to reproduce
briefcase new
structure's app.pybriefcase dev
(or run) and observe that you can switch between the textinputs using tabExpected behavior
I can switch between textinputs at least in the same box with tab.
Screenshots
No response
Environment
Logs
Additional context
No response
The text was updated successfully, but these errors were encountered: