nvaccess / nvda

NVDA, the free and open source Screen Reader for Microsoft Windows
https://www.nvaccess.org/
Other
2.12k stars 638 forks source link

IAccessible2 "labelled-by" property not supported #17436

Open michaelweghorn opened 3 days ago

michaelweghorn commented 3 days ago

IAccessible2 has an IA2_RELATION_LABELLED_BY relation type, see https://accessibility.linuxfoundation.org/a11yspecs/ia2/docs/html/group__grp_relations.html#ga7bbace7ffb57476b75d621af2e27d1ff

However, that one is not taken into account by NVDA's "labeledBy" property for objects, as can be seen for example with LibreOffice that implements handling of the IAccessible2 property.

Steps to reproduce:

  1. start NVDA
  2. Start LibreOffice Writer
  3. open the options dialog: "Tools" -> "Options", go to the "User Data" page
  4. move focus to the "Company" text edit
  5. open NVDA's Python console (Ctrl+Insert+Z)
  6. try to print the object that the currently focused edit is labelled by:
>>> focus.labeledBy
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "C:\tools\cygwin\home\user\development\git\nvda\source\baseObject.py", line 59, in __get__
    return instance._getPropertyViaCache(self.fget)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\tools\cygwin\home\user\development\git\nvda\source\baseObject.py", line 167, in _getPropertyViaCache
    val = getterMethod(self)
          ^^^^^^^^^^^^^^^^^^
  File "C:\tools\cygwin\home\user\development\git\nvda\source\NVDAObjects\IAccessible\__init__.py", line 1167, in _get_labeledBy
    (pacc, accChild) = IAccessibleHandler.accNavigate(
    ^^^^^^^^^^^^^^^^
TypeError: cannot unpack non-iterable NoneType object

Actual behavior:

An error occurs, s. above

Expected behavior:

The label that is referenced by the IA2_RELATION_LABELLED_BY relation should be returned/printed in the Python console.

NVDA logs, crash dumps and other attachments:

System configuration

NVDA installed/portable/running from source:

running from source

NVDA version:

git master as of commit c32e0e78a7a627a800fbf58ca3a4eade9c3c4477

Windows version:

Windows 10 22H2

Name and version of other software in use when reproducing the issue:

LibreOffice

Version: 25.2.0.0.alpha1+ (X86_64) / LibreOffice Community Build ID: 4049405dcde61fa66852dae72d811562c69b3920 CPU threads: 12; OS: Windows 10 X86_64 (10.0 build 19045); UI render: default; VCL: win Locale: en-GB (en_GB); UI: en-US Calc: threaded

Other information about your system:

-

Other questions

Does the issue still occur after restarting your computer?

n/a

Have you tried any other versions of NVDA? If so, please report their behaviors.

NVDA 2024.3, same behavior

If NVDA add-ons are disabled, is your problem still occurring?

n/a

Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?

n/a

michaelweghorn commented 3 days ago

I plan to submit a PR to fix this.