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

On-Screen Keyboard hides and re-shows when backspacing or creating line breaks on some websites

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.15.4
    • 5.14.2, 5.15.2
    • WebEngine
    • None
    • Linux/Wayland, Linux/X11, Linux/Other display system, Windows
    • 84104b7d100553c1550c525759ef6fb4446c31be (qt/qtwebengine/5.15)

    Description

      On some text boxes and on some websites, the On-Screen Keyboard appears to start dismissing then reappear quickly. This occurs when triggering any action which modifies text to the left of the cursor to the start of the line, such as backspacing, triggering auto-punctuation, or inserting a line break with Enter. I've found a few examples where this issue occurs:

      • Etherpad instances (try a test pad at etherpad.ch for the easiest reproduction method)
      • Skype as a webapp
      • Twitter's tweet box

      When the issue is triggered, the keyboard begins dismissing. Some on-screen keyboards (Maliit running as a Wayland input method under KDE Plasma and the QtVirtualKeyboard in embedded input mode) will quickly re-show before the dismiss completes. Maliit running as a QT embedded input method will dismiss completely then unfocus the field in the browser, so it doesn't reappear.

      I've done some more analysis of the code path that's causing the problem in the related bug report on Ubuntu Touch's browser. Summarized:

      It appears that the smoking gun is in render_widget_host_view.cpp, lines 776-781 in 5.15.2:]

       

          const content::TextInputState *state = text_input_manager_->GetTextInputState();
                  if (!state) {
                      m_delegate->inputMethodStateChanged(false /*editorVisible*/, false /*passwordInput*/);
                      m_delegate->setInputMethodHints(Qt::ImhNone);
                      return;
                  }
      

      On the problem websites, Chromium's content::TextInputManager::GetTextInputState() returns a null pointer for a short period of time, causing QtWebEngine to request the keyboard is dismissed in inputMethodStateChanged. The problem is quickly corrected and focus is put back, but it's already too late... the keyboard's dismiss animation has already started playing, and in the case of Maliit in Qt Input Method mode, QML is told to unfocus the focused item.

      I've attached a couple of videos showing the issue with QtVirtualKeyboard blinking in and out of visibility. Both use the following QML for testing:

      import QtWebEngine 1.10
      WebEngineView {
          url: "https://pad.ubports.com/p/junk"
      }
      

      The same QML with https://twitter.com/compose/tweet reproduces the problem, but you have to sign in to Twitter. I ran qmlscene as `QT_IM_MODULE=qtvirtualkeyboard qmlscene qwe.qml`

      Attachments

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

        Activity

          People

            pvarga Peter Varga
            universalsuperbox Dalton Durst
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes