feat(lockscreen): add keyboard focus navigation for power buttons#1139
feat(lockscreen): add keyboard focus navigation for power buttons#1139gugullll wants to merge 2 commits into
Conversation
Add circular Tab/BackTab focus chain across lock, switch user, logout and power action buttons. Loop inside PowerList when opened as popup, break out to surrounding buttons when closed. 添加锁屏界面电源操作按钮的键盘焦点循环导航功能。 Log: 添加锁屏界面电源按钮键盘焦点导航 PMS: BUG-300951 Influence: 用户可通过Tab/Shift+Tab在锁屏界面所有电源操作按钮间切换焦点, 焦点按钮显示高亮边框。
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: gugullll 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 |
|
Hi @gugullll. Thanks for your PR. I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
There was a problem hiding this comment.
Pull request overview
EN: This PR improves lockscreen keyboard accessibility by adding a Tab/Shift+Tab focus chain across the shutdown-related action buttons, and by showing a focus highlight when buttons receive keyboard focus. It primarily wires focus traversal between the outer actions (lock/switch user/logout) and the inner PowerList, and adds looping behavior when PowerList is shown in a popup.
中文: 本 PR 旨在提升锁屏界面的键盘可达性:为锁定/切换用户/注销/电源操作按钮增加 Tab/Shift+Tab 焦点链,并在按钮获得键盘焦点时显示高亮边框;同时在弹出式 PowerList 中实现内部循环导航。
Changes / 变更点:
- Add initial focus + focus traversal between outer action buttons and
PowerList/ 增加初始焦点与外部按钮和PowerList的焦点跳转 - Implement
PowerListloop/break-out behavior for Tab navigation / 实现PowerList的 Tab 循环与跳出行为 - Show focus border when a shutdown button has keyboard focus / 按钮获得键盘焦点时显示边框高亮
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/plugins/lockscreen/qml/ShutdownView.qml |
Adds initial focus and Tab/BackTab routing between lock/switch/logout and the power buttons / 增加初始焦点及外部按钮与电源列表间的 Tab/Shift+Tab 路由 |
src/plugins/lockscreen/qml/ShutdownButton.qml |
Extends highlight condition to include activeFocus / 将高亮条件扩展为包含键盘焦点态 |
src/plugins/lockscreen/qml/PowerList.qml |
Adds focus helpers, loop flag, and edge handling for Tab navigation / 增加聚焦辅助函数、循环标志与 Tab 边界处理 |
src/plugins/lockscreen/qml/ControlAction.qml |
Sets focus + enables internal loop when PowerList is opened as a popup / 弹出电源列表时设置初始焦点并启用内部循环 |
| Component.onCompleted: { | ||
| lockBtn.forceActiveFocus() | ||
| } |
There was a problem hiding this comment.
锁屏状态打开关机界面时,只会创建PowerList,不会创建ShutdownView(ShutdownView包含一个PowerList和三个单独的按钮),不会被抢焦点,见ControlAction.qml中修改部分
| id:powerList | ||
| onTabOutForward: lockBtn.forceActiveFocus() | ||
| onTabOutBackward: logoutBtn.forceActiveFocus() |
There was a problem hiding this comment.
跟上面哪个一样,已锁定状态下不会加载ShutdownView这个界面,不会出现焦点推送到不可见对象的情况。
| KeyNavigation.tab: rebootBtn | ||
| KeyNavigation.backtab: hibernateBtn | ||
| Keys.onBacktabPressed :function(event) { | ||
| if(root.loopInside) | ||
| { |
Adjust keyboard focus visual for ShutdownButton to align with X11 button focus appearance, using white border and tinted background. 调整关机按钮键盘焦点视觉效果,与X11按钮焦点样式保持一致。 Log: 更新关机按钮焦点样式 PMS: BUG-300951 Influence: 关机按钮获得键盘焦点时显示白色边框和半透明背景,与X11样式一致。
Code Review整体评价整体实现思路清晰,为锁屏电源按钮添加了键盘 Tab/BackTab 焦点循环导航,同时为 值得肯定:
问题列表🔴 [必须修复] ControlAction 弹窗关闭后焦点丢失
建议 在 onClosed: {
innerPowerList.loopInside = false
powerItem.forceActiveFocus()
powerItem.expand = false
}🔴 [必须修复] 禁用按钮打断焦点链
建议 为每个使用 🟡 [建议修改] QML 代码格式不一致多处 // 当前
id:lockBtn id:powerList
Keys.onBacktabPressed :function(event) // 冒号前多余空格
// 建议
id: lockBtn id: powerList
Keys.onBacktabPressed: function(event)diff 中也存在多处行尾空白字符,建议清理。 🟡 [建议修改]
|
| 优先级 | 数量 |
|---|---|
| 必须修复 | 2 |
| 建议修改 | 3 |
| 仅供参考 | 1 |
建议先修复焦点丢失和禁用按钮跳过两个关键问题,格式问题可一并清理。
|
TAG Bot New tag: 0.8.15 |
Add circular Tab/BackTab focus chain across lock, switch user, logout and power action buttons. Loop inside PowerList when opened as popup, break out to surrounding buttons when closed.
添加锁屏界面电源操作按钮的键盘焦点循环导航功能。
Log: 添加锁屏界面电源按钮键盘焦点导航
PMS: BUG-300951
Influence: 用户可通过Tab/Shift+Tab在锁屏界面所有电源操作按钮间切换焦点,
焦点按钮显示高亮边框。