Skip to content

IA2: Evaluate "level" object attribute#15882

Merged
seanbudd merged 3 commits into
nvaccess:masterfrom
michaelweghorn:michaelweghorn/heading_level
Dec 6, 2023
Merged

IA2: Evaluate "level" object attribute#15882
seanbudd merged 3 commits into
nvaccess:masterfrom
michaelweghorn:michaelweghorn/heading_level

Conversation

@michaelweghorn

Copy link
Copy Markdown
Contributor

Link to issue number:

Fixes #15881

Summary of the issue:

The "level" object attribute for IAccessible2 to specify the level of a heading is both mentioned in the Core Accessibility API Mappings specification and in the IAccessible2::groupPosition documentation. However, NVDA was not supporting/evaluating this object attribute in order to determine the heading level, resulting in the heading level no longer getting announced once LibreOffice only reports the "level" attribute as specified and no longer the custom "heading-level" attribute that NVDA's soffice app module relies on.

Description of user facing changes

Reporting heading levels also works for LibreOffice version 24.2 and greater.

Description of development approach

Add handling for the "level" IAccessible2 object attribute when determining position info for an IAccessible2 object. In the soffice app module, add a comment that the custom "heading-level" attribute is only needed for Apache OpenOffice by now, since LibreOffice has already been reporting the "level" object attribute in addition to the "heading-level" attribute since LibreOffice 5.0.

Testing strategy:

Test the scenario as described in issue #15881 works as expected with this change in place:

  1. start NVDA
  2. start current development version of LibreOffice including the following change that drops reporting the non-standard "heading-level" object attribute: https://gerrit.libreoffice.org/c/core/+/160347
  3. open the sample document heading.odt
  4. use the cursor up/down key to move between the paragraphs/headings
  5. When moving to a header, verify that NVDA announces the heading level, e.g. says "heading level 1 Heading 1".

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.

 ### Link to issue number:

Fixes nvaccess#15881

 ### Summary of the issue:

The "level" object attribute for IAccessible2 to specify the level of a heading is both mentioned in the [Core Accessibility API Mappings specification](https://www.w3.org/TR/core-aam-1.2/#ariaLevelHeading) and in the [IAccessible2::groupPosition documentation](https://accessibility.linuxfoundation.org/a11yspecs/ia2/docs/html/interface_i_accessible2.html#a94d4d84e000ef2fa3f2abf1148779941).
However, NVDA was not supporting/evaluating this object attribute in
order to determine the heading level, resulting in the heading level no
longer getting announced once LibreOffice only reports the "level"
attribute as specified and no longer the custom "heading-level"
attribute that NVDA's soffice app module relies on.

 ### Description of user facing changes

Reporting heading levels also works for LibreOffice version 24.2 and
greater.

 ### Description of development approach

Add handling for the "level" IAccessible2 object attribute when
determining position info for an IAccessible2 object.
In the soffice app module, add a comment that the custom "heading-level"
attribute is only needed for Apache OpenOffice by now, since
LibreOffice has already been reporting the "level" object attribute
in addition to the "heading-level" attribute since LibreOffice 5.0.

 ### Testing strategy:

Test the scenario as described in issue nvaccess#15881 works as expected with
this change in place:

1. start NVDA
2. start current development version of LibreOffice including the following change that drops reporting the non-standard "heading-level" object attribute: https://gerrit.libreoffice.org/c/core/+/160347
3. open the sample document [heading.odt](https://github.com/nvaccess/nvda/files/13560391/heading.odt)
4. use the cursor up/down key to move between the paragraphs/headings
5. When moving to a header, verify that NVDA announces the heading level, e.g. says "heading    level 1  Heading 1".

 ### Known issues with pull request:

none

 ### Code Review Checklist:

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

Copy link
Copy Markdown

See test results for failed build of commit 1ea286af71

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 6cccd5dc10

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 876e4712e3

@michaelweghorn michaelweghorn force-pushed the michaelweghorn/heading_level branch from cb1bc0e to 4cb2833 Compare December 5, 2023 17:00
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 1951d7b3f7

Fixes issue found by the Chrome system tests, which failed
with this in the NVDA log:

    DEBUG - browseMode.BrowseModeDocumentTreeInterceptor._getInitialCaretPos (09:31:17.815) - MainThread (9604):
    No saved caret position for file:///C:/tools/cygwin/tmp/tmp_7mo_xk6/test.html
    ERROR - queueHandler.flushQueue (09:31:17.815) - MainThread (9604):
    Error in func VirtualBuffer._loadBufferDone
    Traceback (most recent call last):
      File "queueHandler.py", line 64, in flushQueue
        func(*args,**kwargs)
      File "virtualBuffers\__init__.py", line 497, in _loadBufferDone
        self.event_treeInterceptor_gainFocus()
      File "browseMode.py", line 1364, in event_treeInterceptor_gainFocus
        speech.speakObject(self.rootNVDAObject, reason=OutputReason.FOCUS)
      File "speech\speech.py", line 672, in speakObject
        sequence = getObjectSpeech(
                   ^^^^^^^^^^^^^^^^
      File "speech\speech.py", line 711, in getObjectSpeech
        sequence = getObjectPropertiesSpeech(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "speech\speech.py", line 538, in getObjectPropertiesSpeech
        positionInfo=obj.positionInfo
                     ^^^^^^^^^^^^^^^^
      File "baseObject.py", line 62, in __get__
        return instance._getPropertyViaCache(self.fget)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "baseObject.py", line 168, in _getPropertyViaCache
        val=getterMethod(self)
            ^^^^^^^^^^^^^^^^^^
      File "NVDAObjects\IAccessible\ia2Web.py", line 124, in _get_positionInfo
        info=super(Ia2Web,self).positionInfo
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "baseObject.py", line 62, in __get__
        return instance._getPropertyViaCache(self.fget)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "baseObject.py", line 168, in _getPropertyViaCache
        val=getterMethod(self)
            ^^^^^^^^^^^^^^^^^^
      File "NVDAObjects\IAccessible\__init__.py", line 1489, in _get_positionInfo
        info["level"] = self.IA2Attributes["level"]
                        ~~~~~~~~~~~~~~~~~~^^^^^^^^^
    KeyError: 'level'
@michaelweghorn michaelweghorn marked this pull request as ready for review December 6, 2023 11:23
@michaelweghorn michaelweghorn requested a review from a team as a code owner December 6, 2023 11:23
@seanbudd seanbudd merged commit 04120db into nvaccess:master Dec 6, 2023
@nvaccessAuto nvaccessAuto added this to the 2024.1 milestone Dec 6, 2023
@michaelweghorn michaelweghorn deleted the michaelweghorn/heading_level branch December 7, 2023 06:01
tdf-gerrit pushed a commit to LibreOffice/core that referenced this pull request Dec 7, 2023
Stop reporting the custom "heading-level" object attribute in
addition to the "level" attribute.
As described in the Core Accessibility API Mappings spec, the
latter is specified in ARIA and maps to an attribute of
the same name for all of AT-SPI2, IAccessible2 and UIA [1].

Get rid of the non-documented "heading-level" as part of the
goal to align more closely to platform APIs/specifications.

NVDA's LibreOffice-specific app module currently relies on the
custom "heading-level" object attribute [2], but I've reported
an issue and submitted a pull request for this: [3] [4]

While neither the "level" nor the "heading-level" attribute are
currently mentioned in the the IAccessible2 object attribute
specification [5], the IAccessible2 doc for
`IAccessible2::groupPosition` [6] explicitly mentions
the "level" attribute for headings:

> This method is meant to describe the nature of an object's containment
> structure. It's exposed by trees, tree grids, nested lists, nested
> menus, but not headings, which uses the level object attribute.

[1] https://www.w3.org/TR/core-aam-1.2/#ariaLevelHeading
[2] https://github.com/nvaccess/nvda/blob/9cf925195e0fc5ffc67dcfcc9e4d4a7d46ffb430/source/appModules/soffice.py#L225
[3] nvaccess/nvda#15881
[4] nvaccess/nvda#15882
[5] https://wiki.linuxfoundation.org/accessibility/iaccessible2/objectattributes
[6] https://accessibility.linuxfoundation.org/a11yspecs/ia2/docs/html/interface_i_accessible2.html#a94d4d84e000ef2fa3f2abf1148779941

Change-Id: I8e8994cc7565f9b0f40ca8bedff951512f56b59b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160347
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
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.

IAccessible2 "level" object attribute not taken into account for heading levels

5 participants