Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-59643

QtQuick: closing Popup does not restore original focus, breaks Keys.onBackPressed usage

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P2: Important
    • 5.9.6
    • 5.7.1, 5.8.0
    • Quick: Controls 2
    • None
    • Android 4.4, 7.1.1
      Qt from online installer,
      Android SDK Tools 25.2.5

    Description

      My application uses Keys.onBackPressed to override Android back button press to use it for manual navigation through pages.

      I discovered that after using Popup with focused TextField, most parent component (StackView in my case) does not receive Keys.onBackPressed after Popup is closed and so the app quits.

      When using TextField not in Popup, pressing HW back button works as excepted - first it closes on-screen keyboard, and for the second press Keys.onBackPressed is handled that allows to handle navigation and exit that specific page.

      I have attached example application where you can see two use cases - "simple" TextField with activeFocuse and TextField in Popup with activeFocus.

      Workaround is to uncomment line //onClosed: mainStack.forceActiveFocus(), i.e. manually fix focus. If this is by design, it means I can expect losing focus "anywhere" in the future of app development and makes managing keyboard navigation more explicit and complicated.

      Attachments

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            talkless Vincas Dargis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: