Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Announce when moving outside a table in an Excel spreadsheet with UIA #14165

Merged
merged 4 commits into from
Sep 19, 2022

Conversation

michaelDCurran
Copy link
Member

Link to issue number:

None

Summary of the issue:

A particular range of an Excel spreadsheet can be formatted as a self-contained table.
When NVDA uses UIA to access Excel, it announces when focus enteres the table, but does not announce when exiting.
The impact is that the user does not know when focus moves onto a cell outside of the table. E.g. when perhaps trying to enter a new row of data at the bottom.

Technically, tables in Excel are exposed in Excel as UIA elements, themselves containing child cells.
NVDA already announces entering tables as NVDA has had a 'focusEntered' event which fires on all new focus ancestors, but does not have the opposite for firing on old ancestors.

Description of user facing changes

NVDA will now announce "out of table" when focus moves from a cell inside a table, to a cell outside of a table or in a different table.
This is not directly reported in Braille however, as the user has always been able to scroll backward from the cell to see if they are in the table or just the worksheet.

This feature has not been added to NVDA's support for Excel when using the object model (not UIA), and there are no plans to further enhance the older object model code in the future.

Description of development approach

api.setFocusObject now fires a new 'focusExited' event on any ancestor of the old focus, that is not common with the new focus. It does this at the very end, after firing loseFocus and actually setting the focus.
This means, focus-related event ordering is as follows:

  • event_loseFocus fired on the old focus
  • event_focusExited is fired on the old focus's parent (assuming it is not common with the new focus ancestors)
  • event_focusExited is fired on the old focus's parent's parent (assuming it is not common with the new focus)...
  • event_focusEntered is fired on the highest new ancestor for the new focus
  • event_focusEntered is fired on the next highest new ancestor for the new focus...
  • event_gainFocus is fired on the new focus.

Base NVDAObject's event_focusExited does nothing, as generaly, NVDA should not announce when focus exits an ancestor control.
However, a new ExcelTable UIA NVDAObject has an event_focusExited which announces "out of table" if the new focus is still an ExcelCell. I.e. focus exited the table but is still in the spreadsheet. Not doing this check would mean that "out of table" would have been announced when moving away from Excel or into the ribbon etc which is not preferable.

Testing strategy:

  • Ensure NVDA is configured to use UIA for Excel in NVDA's advanced settings.
  • Open example_color_table.xlsx in Excel.
  • Press down arrow multiple times, noticing that NVDA announces when entering the table at a3, and then announces "out of table" at a8.
  • Similarly, moving to d4 and then pressing right arrow, NVDA announces "out of table".

Known issues with pull request:

None known.

Change log entries:

New features

  • Excel with UI automation: NVDA now announces when moving outside a table within a spreadsheet.
    Changes
    Bug fixes
    For Developers

Code Review Checklist:

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

…event is now fired on that ancestor.

The base NVDAObject implementation for this event does nothing. However, Apps such as Excel may wish to make use of this event to announce exiting tables in spreadsheets for example.
the order of loseFocus / focusExited events is now as follows:
loseFocus on the old focus, focusExited on the old focus's parent, focusExited on the old focus's parent's parent...  up to but not including the first common ancestor of old and new focus.
Then as normal, focusEntered on the highest new ancestor, focusEntered on the next highest new ancestor... then gainFocus.
@michaelDCurran michaelDCurran requested a review from a team as a code owner September 19, 2022 03:03
seanbudd
seanbudd previously approved these changes Sep 19, 2022
Copy link
Member

@seanbudd seanbudd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accidentally dismissed this review

@AppVeyorBot
Copy link

See test results for failed build of commit 1abd72776d

@michaelDCurran michaelDCurran merged commit 9fb8ea5 into master Sep 19, 2022
@michaelDCurran michaelDCurran deleted the exitExcelTables branch September 19, 2022 08:34
@nvaccessAuto nvaccessAuto added this to the 2022.4 milestone Sep 19, 2022
michaelDCurran added a commit that referenced this pull request Oct 9, 2022
michaelDCurran added a commit that referenced this pull request Oct 10, 2022
seanbudd pushed a commit that referenced this pull request Oct 10, 2022
…y left out of pr #14165 (#14223)

Summary of the issue:
PR #14165 was to make it so that when moving outside of a table in Excel, NVDA would announce exiting the table.
However, part of the code was accidentally left out of the pr, namely the code to choose the ExcelTable class for Excel table elements.

Description of user facing changes
NVDA will now really report exiting tables in Microsoft Excel.

Description of development approach
UIA NVDAObject's findOverlayClasses includes the ExcelTable NVDAObject class for Excel tables.

Testing strategy:
Performed steps for pr #14165.
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.

4 participants