Skip to content

Don't fall back to IA2 nRelations and friends if relationTargetsOfType succeeds but returns no targets #14360

@jcsteh

Description

@jcsteh

In #13112, NVDAObjects.IAccessible.IAccessible._getIA2TargetsForRelationsOfType gained support for IAccessible2_2::relationTargetsOfType to make retrieval of relations faster. However, this code currently falls back to IAccessible2::nRelations and friends if there were no targets retrieved, even if relationTargetsOfType was successful. nRelations and friends can be slow because the server potentially has to calculate relations the client doesn't even want.

I think _getIA2TargetsForRelationsOfType should only fall back to the old method if relationTargetsOfType fails or is not supported. Currently, a warning is logged if this happens, but the code doesn't early return. If it succeeds, 0 targets is a valid return and should not result in a fallback.

I discovered this because we currently have a case in Firefox where calculation of a particular relation is a bit slow in large documents. It turns out that this particular relation isn't even supported by IA2, so I'm going to fix that, which will eliminate the user impact of this issue. Thus, I can't provide decent steps to reproduce here because the document is huge, which means you need to be using the new accessibility cache which isn't yet enabled by default, and because by the time anyone gets to this, the performance problem will probably no longer be observable due to my fix. Nevertheless, I think it's probably worth fixing this eventually for general performance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    p4https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#prioritytriagedHas been triaged, issue is waiting for implementation.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions