Skip to content

feat(a11y): 补全 dde-session-ui 交互控件 AT-SPI 无障碍名称 - #450

Open
MyLeeJiEun wants to merge 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:agent/at-spi-pr/053dbf38
Open

feat(a11y): 补全 dde-session-ui 交互控件 AT-SPI 无障碍名称#450
MyLeeJiEun wants to merge 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:agent/at-spi-pr/053dbf38

Conversation

@MyLeeJiEun

@MyLeeJiEun MyLeeJiEun commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

概述 / Summary

为 dde-session-ui 补全交互控件的 AT-SPI 无障碍名称(setObjectName / setAccessibleName),提升屏幕阅读器等辅助技术对控件的识别能力。

Completes AT-SPI accessible names (setObjectName / setAccessibleName) for interactive widgets in dde-session-ui, improving recognition by screen readers and other assistive technologies.

覆盖率 / Coverage

Before After
交互控件总数 67 67
已命名 43 62
缺失 24 5
覆盖率 64.2% 92.5%

质量门禁:覆盖率 92.5% ≥ 80% ✅|新增缺口 0 ✅|回归 0 ✅

改动内容 / Changes

19 个交互控件补全 AT-SPI 名称,涉及 8 个文件 / 5 个子模块:

  • dde-osdm_addLayoutAction (QAction,仅 setObjectName)
  • dde-welcomem_enterBtn
  • dde-wm-chooserm_gorgeousBtnm_topSpeedBtn
  • dmemory-warning-dialogm_cancelButtonm_continueButton
  • reset-password-dialogm_buttonBoxm_newPasswordEditm_repeatPasswordEditm_passwordTipsEditm_questionEdit1~3m_answerEdit1~3m_phoneEmailEditm_verificationCodeEditm_sendCodeBtn

命名遵循 PascalCase 规范,由 variable → strip m_ 推导;QAction 仅设置 setObjectName,其余控件同时设置 setObjectName + setAccessibleName。仅做增量补全,未修改任何已有代码或已有命名调用

未处理项说明 / Notes

  1. 5 个 m_view(NotifyListView)跳过dde-osd/src/notification-center 下 5 个类(BubbleItem / BubbleTitleWidget / ItemDelegate / NotifyModel / OverLapWidet)的 m_view 均为同一运行时实例的引用——该实例 m_mainList(notifywidget.cpp:38)已设置 setAccessibleName("NotifyListView")。为避免在同一控件上设置冲突名称,按"增量补全、不修改已有命名"原则跳过,记为扫描器假阳性。

  2. 2 个存量问题未修改(遵循"不修改已有代码"约束)

    • TitleLabel 在 hintsdialog.cpp 与 mainwindow.cpp 重复(跨两个对话框)
    • notification_title(bubbleitem.cpp)为 snake_case,不符合 PascalCase

    二者均为已有命名,本次仅做增量补全,未改动;如需统一可后续单独处理。

验证 / Verification

  • 使用 libclang 重新扫描:124 文件全部解析成功,0 失败;19 个新增命名均被识别。
  • 全量 cmake 构建受限于本机环境(缺少 qdbusxml2cpp-fixlibsystemdxcb-ewmh)未能完成链接;所增调用均为 QWidget/QObject 标准方法(setObjectName/setAccessibleName),语法已由 libclang 解析验证。
  • 回归基线 tests/at/spi/expected_names.yaml 一并提交,供后续 CI 检测命名回归。

测试计划 / Test Plan

  • CI 编译通过
  • 启用屏幕阅读器(Orca)验证 reset-password-dialog / dmemory-warning-dialog / dde-wm-chooser 控件可被正确朗读

Summary by Sourcery

Complete accessible naming for interactive dde-session-ui controls to improve screen-reader support.

New Features:

  • Add AT-SPI object and accessible names to previously unnamed interactive controls across dde-session-ui components, improving assistive-technology recognition.

Enhancements:

  • Raise tracked accessibility-name coverage to 92.5% while preserving existing names and documenting known exclusions.

Tests:

  • Add an expected AT-SPI names baseline for automated scanning and regression detection.

Chores:

  • Add licensing metadata for the new accessibility baseline file.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: MyLeeJiEun

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-ci-robot

Copy link
Copy Markdown

Hi @MyLeeJiEun. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions 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.

@sourcery-ai

sourcery-ai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Reviewer's Guide

Improves dde-session-ui AT-SPI discoverability by adding PascalCase object and accessible names to 19 previously unnamed controls across five submodules, while preserving existing names and shared-instance behavior. A 124-file YAML baseline is added for automated coverage and regression checks, with licensing metadata and SPDX year updates included.

File-Level Changes

Change Details Files
Add AT-SPI object and accessible names to previously unnamed interactive widgets across dde-session-ui.
  • Name the keyboard-layout QAction with setObjectName only.
  • Name welcome, window-chooser, and memory-warning controls with both object and accessible names.
  • Name password-reset inputs, buttons, and button box with PascalCase identifiers.
  • Preserve existing naming calls and avoid adding names to NotifyListView references that share the already-named m_mainList instance.
dde-osd/src/kblayoutindicator.cpp
dde-welcome/src/updatecontent.cpp
dde-wm-chooser/src/wmchooser.cpp
dmemory-warning-dialog/src/dmemorywarningdialog.cpp
reset-password-dialog/passwordwidget.cpp
reset-password-dialog/resetpassworddialog.cpp
reset-password-dialog/securityquestionswidget.cpp
reset-password-dialog/unionidwidget.cpp
Add a tracked accessibility-name baseline and licensing metadata for regression and coverage checks.
  • Record expected object and accessible names for scanned widgets in YAML, including the five intentionally unmodified gaps and existing naming inconsistencies.
  • Register the YAML test assets under CC0-1.0 in REUSE metadata.
tests/at/spi/expected_names.yaml
REUSE.toml
Update SPDX copyright years in touched source files.
  • Extend copyright ranges to 2026 in the modified implementation files.
dde-osd/src/kblayoutindicator.cpp
dde-welcome/src/updatecontent.cpp
dde-wm-chooser/src/wmchooser.cpp
reset-password-dialog/passwordwidget.cpp
reset-password-dialog/securityquestionswidget.cpp
reset-password-dialog/unionidwidget.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@MyLeeJiEun
MyLeeJiEun force-pushed the agent/at-spi-pr/053dbf38 branch from cf52805 to d2b0cfa Compare August 25, 2026 12:57
@MyLeeJiEun
MyLeeJiEun marked this pull request as ready for review August 26, 2026 03:43

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="reset-password-dialog/passwordwidget.cpp" line_range="65-70" />
<code_context>

     this->setAccessibleName("PasswordWidget");

+    m_newPasswordEdit->setObjectName("NewPasswordEdit");
+    m_newPasswordEdit->setAccessibleName("NewPasswordEdit");
+    m_repeatPasswordEdit->setObjectName("RepeatPasswordEdit");
+    m_repeatPasswordEdit->setAccessibleName("RepeatPasswordEdit");
+    m_passwordTipsEdit->setObjectName("PasswordTipsEdit");
+    m_passwordTipsEdit->setAccessibleName("PasswordTipsEdit");
+
     QVBoxLayout *resetPasswordVLayout = new QVBoxLayout(this);
</code_context>
<issue_to_address>
**🚨 issue (security):** The new accessible names are untranslated implementation identifiers such as `NewPasswordEdit`, `QuestionEdit1`, `SendCodeBtn`, and `ButtonBox`, so screen readers announce internal PascalCase names instead of the visible, localized control meaning. This makes the reset-password fields and actions difficult to understand for users, especially when the visible labels are localized or when multiple similarly named controls are present.

**Triggers:** When a screen reader consumes any of the newly named controls.

**Suggested fix:** Use localized, user-facing accessible names derived from the visible labels (and include the question number or current question text where needed), rather than variable-derived identifiers.

```suggestion
    m_newPasswordEdit->setObjectName("NewPasswordEdit");
    m_newPasswordEdit->setAccessibleName(tr("New Password"));
    m_repeatPasswordEdit->setObjectName("RepeatPasswordEdit");
    m_repeatPasswordEdit->setAccessibleName(tr("Repeat Password"));
    m_passwordTipsEdit->setObjectName("PasswordTipsEdit");
    m_passwordTipsEdit->setAccessibleName(tr("Password Hint"));
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +65 to +70
m_newPasswordEdit->setObjectName("NewPasswordEdit");
m_newPasswordEdit->setAccessibleName("NewPasswordEdit");
m_repeatPasswordEdit->setObjectName("RepeatPasswordEdit");
m_repeatPasswordEdit->setAccessibleName("RepeatPasswordEdit");
m_passwordTipsEdit->setObjectName("PasswordTipsEdit");
m_passwordTipsEdit->setAccessibleName("PasswordTipsEdit");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 issue (security): The new accessible names are untranslated implementation identifiers such as NewPasswordEdit, QuestionEdit1, SendCodeBtn, and ButtonBox, so screen readers announce internal PascalCase names instead of the visible, localized control meaning. This makes the reset-password fields and actions difficult to understand for users, especially when the visible labels are localized or when multiple similarly named controls are present.

Triggers: When a screen reader consumes any of the newly named controls.

Suggested fix: Use localized, user-facing accessible names derived from the visible labels (and include the question number or current question text where needed), rather than variable-derived identifiers.

Suggested change
m_newPasswordEdit->setObjectName("NewPasswordEdit");
m_newPasswordEdit->setAccessibleName("NewPasswordEdit");
m_repeatPasswordEdit->setObjectName("RepeatPasswordEdit");
m_repeatPasswordEdit->setAccessibleName("RepeatPasswordEdit");
m_passwordTipsEdit->setObjectName("PasswordTipsEdit");
m_passwordTipsEdit->setAccessibleName("PasswordTipsEdit");
m_newPasswordEdit->setObjectName("NewPasswordEdit");
m_newPasswordEdit->setAccessibleName(tr("New Password"));
m_repeatPasswordEdit->setObjectName("RepeatPasswordEdit");
m_repeatPasswordEdit->setAccessibleName(tr("Repeat Password"));
m_passwordTipsEdit->setObjectName("PasswordTipsEdit");
m_passwordTipsEdit->setAccessibleName(tr("Password Hint"));

@MyLeeJiEun
MyLeeJiEun force-pushed the agent/at-spi-pr/053dbf38 branch from d2b0cfa to dbc9ccf Compare August 26, 2026 06:28
Add setObjectName/setAccessibleName for interactive widgets across
dde-osd, dde-welcome, dde-wm-chooser, dmemory-warning-dialog,
dde-hints-dialog and reset-password-dialog. Coverage raised from
64.2% to 92.5%.

为 dde-osd、dde-welcome、dde-wm-chooser、dmemory-warning-dialog、
dde-hints-dialog 与 reset-password-dialog 等模块的交互控件补全
setObjectName/setAccessibleName 调用,AT-SPI 名称覆盖率由 64.2%
提升至 92.5%。

Log: 补全 dde-session-ui 交互控件 AT-SPI 无障碍名称
Influence: 提升屏幕阅读器等辅助技术对控件的识别能力,不改变现有功能逻辑
@MyLeeJiEun
MyLeeJiEun force-pushed the agent/at-spi-pr/053dbf38 branch from dbc9ccf to 3389d42 Compare August 26, 2026 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants