Accessibility: text interface is exposed for every accessible item

オープン 初心者向け
#284 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
85/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
cpp
領域
accessibility

調査の方向性

framework/accessibility/internal/accessibleiteminterface.cpp の AccessibleItemInterface::interface_cast から始め、関連する Windows UI Automation と AT-SPI の動作を確認します。EditableText 項目だけが Text interface を公開し、ボタン、リスト項目、グループ、その他のテキスト以外の要素は Text pattern を報告しなくなっていることを確認してください。

索引モデルが issue の本文から書いたものです。

説明

Issue type

Bug (accessibility, all platforms; most visible on Windows through UI Automation)

Description

Every accessible item in the framework exposes a text interface, whatever its role. Buttons, check boxes, list items, groups and non-text score elements all report that they are text.

Qt decides per platform whether an element is a text control by asking the accessible interface for its text interface. On Windows, the UI Automation backend offers the Text pattern to assistive technology exactly when that call returns a non-null pointer (QWindowsUiaMainProvider::GetPatternProvider, case UIA_TextPatternId). The AT-SPI backend on Linux uses the same call to add the Text interface to every element.

The framework's AccessibleItemInterface::interface_cast returns the text interface unconditionally:

https://github.com/musescore/muse_framework/blob/a908ba77f867199d07830b0d1524988e33e9a186/framework/accessibility/internal/accessibleiteminterface.cpp#L531-L539

As a result every control reports IsTextPatternAvailable = true in UIA. For non-text controls the exposed text document is empty, because the item's text hooks return an empty string and a character count of zero.

Screen readers such as NVDA treat any element with a Text pattern as a text container. Buttons and list items then behave like empty text documents instead of like buttons and list items: text review, braille routing and caret tracking operate on an empty document instead of on the control's name.

Steps to reproduce
  1. Start MuseScore Studio on Windows.
  2. Open Accessibility Insights for Windows or Inspect.exe.
  3. Move keyboard focus to any button, or to an item in a list.
  4. Look at the patterns reported for the focused element.

Expected: no Text pattern on a button or list item.
Actual: IsTextPatternAvailable is true, and the Text pattern's document range is empty.

Root cause

The unconditional branch dates from the commit that added screen reader access to score text (musescore/MuseScore#10371). It was never restricted to text items. It did not need to be unconditional: score text elements already register with the EditableText role (TextBase::createAccessible), and the only QML consumer of the accessible.text property is the braille view, which also uses EditableText.

Qt's own reference implementation for Quick items limits the text interface to text roles (QAccessibleQuickItem::interface_cast returns it only for EditableText, StaticText and Heading).

Proposed fix

Return the text interface only when the framework role of the item is EditableText. The check must use the framework role, not the Qt role. On Windows the framework maps Group, Information and ElementOnScore to QAccessible::StaticText, so a check on the Qt role would still leak the Text pattern to every non-text score element.

     if (type == QAccessible::InterfaceType::ValueInterface && itemRole == QAccessible::Slider) {
         return static_cast<QAccessibleValueInterface*>(this);
-    } else if (type == QAccessible::InterfaceType::TextInterface) {
+    } else if (type == QAccessible::InterfaceType::TextInterface
+               && m_object->item()->accessibleRole() == IAccessible::Role::EditableText) {
         return static_cast<QAccessibleTextInterface*>(this);
     }

StaticText is deliberately left out. No item with that role sets accessible text today, so including it would keep exposing empty text documents on labels.

The comment at lines 542 and 547 says "Without Action and Text interfaces NVDA doesn't work" for list items. That comment was added a year after the text interface became unconditional, so the Text half of that claim was never observed in isolation. NVDA announces UIA list items from their Name property and does not need a Text pattern for that.

主要言語
C++
スター
14
フォーク
79
平均マージ
1日 14時間
マージ済み PR(30日)
43

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

musescore/muse_framework のほかの issue

musescore/muse_framework の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。