fix: enable keyboard navigation in move note dialog#387
Conversation
log:The notebook ListView was skipped in the Tab chain and its selection only updated on mouse click, so Tab could not reach the list and arrow keys could not switch notebooks. Make currentIndex the single source of truth, enable activeFocusOnTab and key navigation, and sync it to dialog.index. pms: bug-367597
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: JWWTSL The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
deepin pr auto review★ 总体评分:100分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 --- a/src/gui/dialog/MoveDialog.qml
+++ b/src/gui/dialog/MoveDialog.qml
@@ -20,7 +20,7 @@ DialogWindow {
height: 365
width: 370
- onVisibleChanged: if (visible) index = 0
+ onVisibleChanged: if (visible) folderList.currentIndex = 0
header: DialogTitleBar {
enableInWindowBlendBlur: true
@@ -41,10 +41,16 @@ DialogWindow {
ListView {
id: folderList
+ activeFocusOnTab: true
clip: true
height: 226
+ keyNavigationEnabled: true
width: 348
+ // currentIndex 作为选中项的唯一来源,同步给 dialog.index,
+ // 使 Tab 可聚焦列表、上/下方向键可切换记事本
+ onCurrentIndexChanged: dialog.index = currentIndex
+
ScrollBar.vertical: ScrollBar {
}
delegate: Rectangle {
@@ -124,7 +130,7 @@ DialogWindow {
hoverEnabled: true
onClicked: {
- dialog.index = index;
+ folderList.currentIndex = index;
}
onEntered: {
folderItem.isHovered = true; |
log:The notebook ListView was skipped in the Tab chain and its selection only updated on mouse click, so Tab could not reach the list and arrow keys could not switch notebooks. Make currentIndex the single source of truth, enable activeFocusOnTab and key navigation, and sync it to dialog.index.
pms: bug-367597