Skip to content

Commit 6dae2ee

Browse files
committed
fix: set focus to search edit when launcher becomes visible
When the launcher is shown, the keyboard focus remains on the root InputEventItem instead of the search edit. This causes two issues: 1. The cursor does not appear in the search bar on each open. 2. The IME candidate window is not visible during the preedit phase (e.g. typing pinyin), because InputEventItem is not a text input widget and cannot provide cursor geometry for IME positioning. Fix by calling forceActiveFocus() on the search edit when the launcher becomes visible, for both windowed and fullscreen modes. 修复启动器显示时搜索框未获得焦点的问题。启动器打开时键盘焦点停留在根节点 InputEventItem 上而非搜索框,导致光标不在搜索栏,且中文输入法预编辑阶段 (如拼音输入时)候选框不可见。在启动器可见时对搜索框调用 forceActiveFocus() 以修复此问题,同时修复窗口模式和全屏模式。 PMS: BUG-301743
1 parent c39aac4 commit 6dae2ee

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

qml/FullscreenFrame.qml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,8 +883,12 @@ InputEventItem {
883883
Connections {
884884
target: LauncherController
885885
function onVisibleChanged() {
886+
if (LauncherController.visible) {
887+
searchEdit.forceActiveFocus()
888+
return
889+
}
890+
886891
// only do these clean-up steps on launcher get hide
887-
if (LauncherController.visible) return
888892
// clear searchEdit text
889893
searchEdit.text = ""
890894
if (listviewPage.currentItem) {

qml/windowed/WindowedFrame.qml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,12 @@ InputEventItem {
303303
Connections {
304304
target: LauncherController
305305
function onVisibleChanged() {
306-
// only do these clean-up steps on launcher get hide
307-
if (LauncherController.visible) return
306+
if (LauncherController.visible) {
307+
bottomBar.searchEdit.forceActiveFocus()
308+
return
309+
}
308310

311+
// only do these clean-up steps on launcher get hide
309312
// clear searchEdit text
310313
bottomBar.searchEdit.text = ""
311314
// reset(remove) keyboard focus

0 commit comments

Comments
 (0)