Skip to content

Only call _getIA2RelationFirstTarget for IA2 objects#18416

Merged
seanbudd merged 3 commits into
nvaccess:masterfrom
LeonarddeR:IA2DebugLog
Jul 7, 2025
Merged

Only call _getIA2RelationFirstTarget for IA2 objects#18416
seanbudd merged 3 commits into
nvaccess:masterfrom
LeonarddeR:IA2DebugLog

Conversation

@LeonarddeR

Copy link
Copy Markdown
Collaborator

Link to issue number:

None

Summary of the issue:

Several properties on IAccessible objects call the _getIA2RelationFirstTarget method without checking whether we're really dealing with an IA2 object. This results in unnecessary and verbose debug warnings:

DEBUGWARNING - NVDAObjects.IAccessible.IAccessible._getIA2RelationFirstTarget (14:36:37.817) - MainThread (14260):
Unable to use _getIA2TargetsForRelationsOfType, fallback to _IA2Relations.

Description of user facing changes:

Less debug warnings.

Description of developer facing changes:

None

Description of development approach:

  1. For every property that calls _getIA2RelationFirstTarget, check whether the object is IA2
  2. Call super when not IA2. This changes behavior for the flowsFrom and flowsTo properties on MSAA objects. These will now raise a NotImplementedError, which is in line with what NVDAObject does by default. Therefore I don't think this can be considered API breaking, rather the behavior of the IAccessible implementation was inconsistent and misleading. Note that flowsFrom and flowsTo raise NotImplementedError for UIA objects, too.

Testing strategy:

Ran from source, called the several properties. Ensured no obnoxious debug warnings were logged.

Known issues with pull request:

None

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@coderabbitai summary

@LeonarddeR LeonarddeR requested a review from a team as a code owner July 4, 2025 12:48
@LeonarddeR LeonarddeR requested a review from seanbudd July 4, 2025 12:48
Comment thread source/NVDAObjects/IAccessible/__init__.py Outdated
Comment thread source/NVDAObjects/IAccessible/__init__.py Outdated
Comment thread source/NVDAObjects/IAccessible/__init__.py Outdated
Comment thread source/NVDAObjects/IAccessible/__init__.py Outdated
@seanbudd

seanbudd commented Jul 7, 2025

Copy link
Copy Markdown
Member

Thanks @LeonarddeR

@seanbudd seanbudd merged commit c5cde54 into nvaccess:master Jul 7, 2025
16 of 17 checks passed
@github-actions github-actions Bot added this to the 2025.3 milestone Jul 7, 2025
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