Skip to content

MS Word with UIA: support moving by sentence with legacy object model when available#12874

Merged
michaelDCurran merged 6 commits into
masterfrom
i9254
Oct 1, 2021
Merged

MS Word with UIA: support moving by sentence with legacy object model when available#12874
michaelDCurran merged 6 commits into
masterfrom
i9254

Conversation

@michaelDCurran

@michaelDCurran michaelDCurran commented Sep 24, 2021

Copy link
Copy Markdown
Member

Link to issue number:

Fixes #9254

Summary of the issue:

In the past, NVDA has had the functionality to move by sentence in MS word (alt+downArrow and alt+upArrow). This functionality used the MS Word object model.
With the switch to using UI automation to access MS Word, move by sentence was lost, as MS Word's UI automation implementation provides no concept of a sentence unit.

Description of how this pull request fixes the issue:

This pr provides an implementation of moving by sentence for MS Word with UIA by falling back to the MS word object model for this specific feature, if the object model is available.
This therefore will work in MS Word and Outlook, but not in Windows Mail.

Testing strategy:

  • Enabled Use UIA to access Microsoft Word document controls in NVDA's advanced settings.
  • Open a Word document with multiple sentences.
  • Press alt+downArrow and or alt+upArrow to move forward and back through the document by sentence.
  • Ensure that NVDA speaks each sentence, and moves the braille display appropriately.

Known issues with pull request:

Our goal must be to use UIA by default in MS Word, and not rely on the object model, as Microsoft is no longer fixing existing or new bugs found with the object model.
It could be possible in future that even making this small set of object model calls could introduce unknown unstable behaviour in future builds of MS Word, thus it is very important that we switch to using UI automation to move by sentence as soon as it is possible to do so. Microsoft has planned to expose this vya UIA custom patterns in the very near future.

Change log entries:

Bug fixes

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

…row) where the legacy MS Word object model is still available. E.g. MS Word, Outlook, but not Windows Mail.

This implementation should be removed and replace with pure UI Automation as soon as moving by sentence is supported by MS Word with UI Automation custom patterns.
@michaelDCurran michaelDCurran requested a review from a team as a code owner September 24, 2021 03:00
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit e58e650ebe

if isScriptWaiting():
return
if not self.WinwordSelectionObject:
# Legacy object model not available.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should an error be logged here?

Comment thread source/NVDAObjects/UIA/wordDocument.py Outdated
@michaelDCurran michaelDCurran merged commit df92ef6 into master Oct 1, 2021
@michaelDCurran michaelDCurran deleted the i9254 branch October 1, 2021 00:52
@nvaccessAuto nvaccessAuto added this to the 2021.3 milestone Oct 1, 2021
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.

Reading by sentence is broken in MS Outlook and Word

5 participants