Skip to content

fix: add AT-SPI accessible names for missing widget classes - #315

Draft
re2zero wants to merge 1 commit into
linuxdeepin:masterfrom
re2zero:fix/at-spi-completion-20260805
Draft

fix: add AT-SPI accessible names for missing widget classes#315
re2zero wants to merge 1 commit into
linuxdeepin:masterfrom
re2zero:fix/at-spi-completion-20260805

Conversation

@re2zero

@re2zero re2zero commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Add setAccessibleName() calls and register missing widget classes in the accessible factory to improve AT-SPI / accessibility coverage.

Changes

accessible.h — New widget registrations

  • TitleMenu, FindWidget, SlidePlayWidget, FileAttrWidget: New SET_FORM_ACCESSIBLE entries
  • SideBarImageListView, CatalogTreeView: DListView/DTreeView subclasses
  • HandleMenu, ScaleMenu, BrowserMenu: DMenu subclasses
  • QTextEdit: SET_EDITABLE_ACCESSIBLE generic registration
  • DFloatingWidget, DMenu, DAbstractDialog, DListView, DTreeView: Generic DTK base types
  • Fixed missing USE_ACCESSIBLE for DLabel and DToolButton

setAccessibleName() additions

  • SlidePlayWidget: widget + buttons (previous_normal/play_normal/next_normal/exit_normal)
  • TransparentTextEdit: widget itself
  • HandleMenu, ScaleMenu: menu widgets
  • FileAttrWidget, FindWidget: dialog/widget names
  • SideBarImageListView, CatalogTreeView: list/tree controls
  • SlideWidget: slideshow widget
  • ScaleWidget: widget + zoom in/out buttons + scale menu button
  • CentralDocPage: tab label
  • DocSheet::LoadingWidget: loading indicator
  • EncryptionPage: icon label, info label, password edit
  • SecurityDialog: title/content labels

AT-SPI coverage improvement

  • Before: ~25% of custom widget classes were unregistered in the accessible factory
  • After: All Qt/DTK widget subclasses now have proper accessible entries

Summary by Sourcery

Improve accessibility coverage by registering previously missing widgets in the accessibility factory and assigning accessible names to key UI components.

Enhancements:

  • Register additional custom Qt and DTK widget subclasses (menus, dialogs, lists, trees, floating widgets) with AT-SPI accessibility mappings.
  • Enable QTextEdit and core DTK base types to participate in the generic accessibility infrastructure.
  • Assign explicit accessible names to dialogs, widgets, labels, buttons, spinners, and password fields in reader UI screens to improve screen reader usability.

Add setAccessibleName() calls and register missing widget classes in the
accessible factory to improve AT-SPI / accessibility coverage.

- Register new widget classes in accessible.h: TitleMenu, FindWidget,
  SlidePlayWidget, FileAttrWidget, SideBarImageListView, CatalogTreeView,
  HandleMenu, ScaleMenu, BrowserMenu
- Add setAccessibleName() calls in constructors for widget-level names
- Add accessible names for child controls in SlidePlayWidget, ScaleWidget,
  CentralDocPage, DocSheet, EncryptionPage, SecurityDialog
- Enable factory support for QTextEdit, DFloatingWidget, DMenu,
  DAbstractDialog, DListView, DTreeView, DLabel, DToolButton

These changes ensure that the accessibility layer can properly identify and
expose UI components via the AT-SPI interface.
@deepin-ci-robot

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: re2zero

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

@sourcery-ai

sourcery-ai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Reviewer's Guide

Registers previously-uncovered custom Qt/DTK widgets in the accessibility factory and assigns explicit accessible names to key widgets and controls, improving AT-SPI coverage and screen reader labeling across the reader UI.

Sequence diagram for accessibleFactory handling newly registered widgets

sequenceDiagram
    actor ScreenReader
    participant AT_SPI as AT_SPI_Bridge
    participant QtAcc as QAccessible
    participant Factory as accessibleFactory
    participant Widget as SlidePlayWidget

    ScreenReader->>AT_SPI: request_accessible_interface
    AT_SPI->>QtAcc: QAccessible::queryAccessibleInterface
    QtAcc->>Factory: accessibleFactory(classname, object)
    Factory->>Factory: USE_ACCESSIBLE(SlidePlayWidget)
    Factory-->>QtAcc: QAccessibleInterface
    QtAcc-->>AT_SPI: QAccessibleInterface
    AT_SPI-->>ScreenReader: expose_accessible_tree

    ScreenReader->>AT_SPI: get_name(Widget)
    AT_SPI->>Widget: QAccessibleInterface::text
    Widget->>Widget: setAccessibleName("SlidePlayWidget")
    Widget-->>AT_SPI: accessible_name
    AT_SPI-->>ScreenReader: label "SlidePlayWidget"
Loading

File-Level Changes

Change Details Files
Register missing custom widgets and base DTK/Qt classes in the accessibility factory so they expose QAccessible interfaces.
  • Include headers for additional widget classes (e.g., FindWidget, SlidePlayWidget, FileAttrWidget, TransparentTextEdit, SideBarImageListView, CatalogTreeView, HandleMenu, ScaleMenu, BrowserMenu).
  • Add SET_FORM_ACCESSIBLE/SET_EDITABLE_ACCESSIBLE entries for new custom widgets and base classes, including QTextEdit and several DTK base widgets (DFloatingWidget, DMenu, DAbstractDialog, DListView, DTreeView).
  • Add corresponding USE_ACCESSIBLE mappings in accessibleFactory() for the new custom widgets and DTK/Qt base classes, and ensure DLabel and DToolButton now use accessibility implementations.
reader/app/accessible.h
Assign explicit accessible names to key widgets and child controls to improve screen reader descriptions.
  • Set accessible names on container widgets such as ScaleWidget, SlidePlayWidget, SlideWidget, FileAttrWidget, FindWidget, HandleMenu, ScaleMenu, SecurityDialog, CatalogTreeView, SideBarImageListView, CentralDocPage tab label, TransparentTextEdit, and DocSheet::LoadingWidget.
  • Set accessible names for child controls like zoom buttons and scale menu button in ScaleWidget, slide control buttons in SlidePlayWidget, SecurityDialog title/content labels, EncryptionPage icon and info labels and password edit, and the loading spinner in DocSheet::LoadingWidget.
reader/widgets/ScaleWidget.cpp
reader/widgets/SecurityDialog.cpp
reader/widgets/EncryptionPage.cpp
reader/uiframe/DocSheet.cpp
reader/widgets/SlidePlayWidget.cpp
reader/sidebar/CatalogTreeView.cpp
reader/sidebar/SideBarImageListview.cpp
reader/uiframe/CentralDocPage.cpp
reader/widgets/FileAttrWidget.cpp
reader/widgets/FindWidget.cpp
reader/widgets/HandleMenu.cpp
reader/widgets/ScaleMenu.cpp
reader/widgets/SlideWidget.cpp
reader/widgets/TransparentTextEdit.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

@re2zero

re2zero commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

❌ 本地验证失败(编译错误)

已在本地子项目 deepin-reader 完成 cherry-pick + 代码 review + dpkg 编译验证:

  • Cherry-pick: 干净(15 文件,+70/-2,无冲突)
  • 代码 Review: FAIL —— 发现会导致编译失败的硬错误
  • 编译: dpkg-buildpackage -us -uc -b -tc -j$(nproc) 失败(exit 2,约 96% 进度处)

致命错误reader/app/accessible.h:93 新增 SET_EDITABLE_ACCESSIBLE(QTextEdit, ...),宏展开生成 return m_w->text();,但 QTextEdit 没有 text() 成员(只有 toPlainText()/toHtml()):

reader/app/accessibledefine.h:143:21: error: 'class QTextEdit' has no member named 'text'
  143 |         return m_w->text(); \

修复建议:将 FUNC_TEXT_ 宏对 QTextEdit 的处理改为 toPlainText()(或对 QTextEdit 单独定义 text() 实现)。

✅ 其余改动(9 个 SET_FORM_ACCESSIBLE 类、setAccessibleName() 调用、新增 include)均已核实无误,无无关文件误改、无版权/dep5 问题。修复该错误后即可编译通过。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants