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

Changing the QWebEnginePage of a QWebEngineView moves the internal focus the old page

    XMLWordPrintable

Details

    Description

      Let's say we have:

      QWebEngineView *view;
      QWebEnginePage *page1;
      QWebEnginePage *page2;
      

      And the view alternates between showing page1 and page2.

      Each call like

      // view is showing pageX
      view->setPage(pageY);
      // view is now showing pageY
      

      will move the internal focus of pageX if the view had the focus when setPage() is called.

      I have attached to this ticket a minimal app showing the issue and a video recording of this app.

      My understanding of the causes is that when changing the page of a QWebEngineView, its internal QQuickWidget is hidden and deleted.

      When it is hidden, QWidgetPrivate::hide_helper() is called.
      Because the QQuickWidget being hidden has focus, QWidgetPrivate::hide_helper() will then call QQuickWidget::focusNextPrevChild().
      Then QQuickWidget::focusNextPrevChild() will send a tab down and a tab up event to its internal QQuickView that will end up forwarded to the QWebEnginePage.

      I was able to see the tab events in GammaRay and in Chromium, using JS to listen to key events in the DOM.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt_webengine_team Qt WebEngine Team
            bterrier Benjamin Terrier
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes