Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.14.2, 5.15.2
-
None
-
QtWebEngine 5.14.2 tested on Kubuntu 20.04 (Where it was built with Qt 5.14.2 and used with QtVirtualKeyboard) and Ubuntu Touch (where it was built with Qt 5.12 and used with Maliit in embedded input mode)
QtWebEngine 5.15.2 tested on Kubuntu 20.10 daily image (built with 5.15.2 with QtVirtualKeyboard) and Manjaro Plasma for arm64 (5.15.2, Maliit acting as a Wayland input method)QtWebEngine 5.14.2 tested on Kubuntu 20.04 (Where it was built with Qt 5.14.2 and used with QtVirtualKeyboard) and Ubuntu Touch (where it was built with Qt 5.12 and used with Maliit in embedded input mode) QtWebEngine 5.15.2 tested on Kubuntu 20.10 daily image (built with 5.15.2 with QtVirtualKeyboard) and Manjaro Plasma for arm64 (5.15.2, Maliit acting as a Wayland input method)
-
-
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`