toga icon indicating copy to clipboard operation
toga copied to clipboard

OptionContainer.on_select doesn't see the new selection on Android

Open Casimir1965 opened this issue 6 months ago • 1 comments

Describe the bug

While using the original code from the example repo, I got a strange situation on my Android phone: Starting the app and just clicking on option 2 (as example) and nothing else, the text from on_select_handler is always one click behind. Meaning widget.current_tab.index and widget.current_tab.text are not properly set from the phone. Briefcase dev runs without this error as well as briefcase run linux.

Steps to reproduce

  1. Go to toga github example repo. Download the OptionContainerExample code and execute it on an Android device (or simulator).
  2. Check the screen especially "Tab 0 has been choosen: Option 0"
  3. Click on 'Option 2' and look what is happen with the text: nothing
  4. Click again on 'Option2' and the text is now showing the right information: "Tab 2 has been choosen: Option 2". The app is always one click behind you ;-)
  5. See error

Expected behavior

If you click on Option 1 or 2, the status text needs to be adjusted correctly.

Screenshots

No response

Environment

  • Operating System: DISTRIB_ID=Ubuntu DISTRIB_RELEASE=24.04 DISTRIB_CODENAME=noble DISTRIB_DESCRIPTION="TUXEDO OS 24.04.1 LTS" NAME="TUXEDO OS" VERSION="24.04.1 LTS" ID=tuxedo ID_LIKE="ubuntu debian" PRETTY_NAME="TUXEDO OS" VERSION_ID="24.04" HOME_URL="https://tuxedocomputers.com/" SUPPORT_URL="https://support.tuxedocomputers.com/" BUG_REPORT_URL="https://gitlab.com/tuxedocomputers/development/tuxedo_os/os" PRIVACY_POLICY_URL="https://www.tuxedocomputers.com/en/Privacy-policy.tuxedo" VERSION_CODENAME=noble UBUNTU_CODENAME=noble

  • Python version: Python 3.12.3

  • Software versions:

    • Briefcase: Version: 0.3.23
    • Toga: 0.5.1
    • Android Emulator: 35.49.9-13025442
    • Android phone: Google Pixel 8 Pro
    • Android Version: GrapheneOS Version 15 Build 2025052800 ...

Casimir1965 avatar May 31 '25 12:05 Casimir1965

Confirmed: I see the same behavior on the Toga main branch. The on_select handler is probably being called too early.

mhsmith avatar Jun 02 '25 12:06 mhsmith