Skip to content

Browse mode in MS Word with UIA: ensure scrolling and carret position are always synched#12829

Closed
michaelDCurran wants to merge 3 commits into
masterfrom
i9611_small
Closed

Browse mode in MS Word with UIA: ensure scrolling and carret position are always synched#12829
michaelDCurran wants to merge 3 commits into
masterfrom
i9611_small

Conversation

@michaelDCurran

@michaelDCurran michaelDCurran commented Sep 9, 2021

Copy link
Copy Markdown
Member

Link to issue number:

Fixes #9611
Replaces pr #12803

Summary of the issue:

When reading / navigating with browse mode in Microsoft Word via UI Automation, the document does not always scroll so that the current browse mode position is visible on screen, nor does the focus mode caret position stay in sync with the browse mode caret, especially when moving across pages in browse mode.
Browse mode currently only knows how to scroll to objects in the document, not specific text range positions. Thus, it is only able to scroll to lists, tables and graphics, and not any arbitrary text.
Also, setting the caret in Microsoft Word to a range that is on a page that is currently off screen seems to fail and or set the caret to a random point on the current page.

Description of how this pull request fixes the issue:

  • browseMode.BrowseModeDocument: abstract the scrolling code out of _set_selection into its own scrollToPosition method on BrowseModeDocument.
  • BrowseModeDocument for MS Word with UIA: override scrollToPosition to just call IUIAutomationTextRange::ScrollIntoView. This ensures that the specific text range for the given TextInfo is visible on screen, rather than scrolling to the deepest object (which is only tables and lists in MS Word, so was not always accurate).

Testing strategy:

Known issues with pull request:

This specifically addresses browse mode scrolling issues in MS Word with UIA enabled as these scrolling issues were also affecting syncing of the focus mode caret with the browse mode caret. But there remains scrolling issues in other apps, which have always existed. Pr #9919 goes much further in addressing all of these, but is rather complex and requires a lot more review and testing. This particular pr is much smaller and stays specific to what we need to unblock enabling UIA by default in MS Word.

Change log entries:

Bug fixes:

Code Review Checklist:

  • Pull Request description is up to date.
  • Unit tests.
  • System (end to end) tests.
  • Manual testing.
  • API is compatible with existing addons.
  • User Documentation.
  • Change log entry.
  • Context sensitive help for GUI changes.
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers

MS Word with UIA browse mode: override scrollToPosition to call scrollIntoview on IUIAutomationTextRange.

Fixes #9611
@michaelDCurran michaelDCurran requested a review from a team as a code owner September 9, 2021 23:12
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 223e0f7957

@michaelDCurran

Copy link
Copy Markdown
Member Author

@Qchristensen I had to revert the last fix for #9611 as it was a bit too broad for NVDA 2021.3. Could you therefore please test the following try build: https://ci.appveyor.com/api/buildjobs/6m157vcnkuuddl6c/artifacts/output%2Fnvda_snapshot_try-i9611_small-23726%2C69618f72.exe
This one is much more specific just to MS word with UIA. Again, please test that when reading a Word document with browse mode that the document correctly scrolls.

@Qchristensen

Copy link
Copy Markdown
Member

This try build doesn't implement the fix for me - I opened the Basic Training module and pressed NVDA+down arrow. The caret visually appeared to move while within the visible portion of the document. Once out of view, the document did not scroll at all. If I stopped say all with say an arrow key, it would jump to the current line it was reading IF that line was on the current page, but after that when I stopped say all the caret was back where I'd started. No error in the log.

@michaelDCurran

michaelDCurran commented Sep 15, 2021 via email

Copy link
Copy Markdown
Member Author

@cary-rowen

Copy link
Copy Markdown
Contributor

Another question, I don't know if it is related to this, the braille cursor cannot be scrolled in focus mode. I will find a few devices to confirm this issue later, and then I will open an issue

@Qchristensen

Copy link
Copy Markdown
Member

@michaelDCurran I'm glad I at least documented my process, even if I didn't READ what I was supposed to be doing this time around :)

You are right, I was in focus mode for that previous test. So, I tried again and this time press NVDA+Spacebar before pressing NVDA+down arrow.

In this case, the caret moved visibly while in the portion of the document visible on screen. The document did NOT visibly scroll once the caret moved past the bottom of the screen. When I stopped the say all however, the caret was in the expected place (say three and a half pages into the document) and the view jumped to that point as well.

@michaelDCurran

michaelDCurran commented Sep 15, 2021 via email

Copy link
Copy Markdown
Member Author

@Qchristensen

Copy link
Copy Markdown
Member

With the new build:
Focus mode in Word, Browse mode in word, and single letter navigation keys all work as expected. The focus moves with reading, and the document scrolls while reading to keep the text being read in view. Good work!

@michaelDCurran

Copy link
Copy Markdown
Member Author

Replacing with #12851

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.

Focus movement changing between focus and browse mode with UIA in Word 365

5 participants