Ensure documents always scroll to exact browse mode position#12803
Conversation
lukaszgo1
left a comment
There was a problem hiding this comment.
There are some unrelated changes in this PR. Can it be rebased on master?
| self.obj.WinwordWindowObject.ScrollIntoView(self._rangeObj, True) | ||
| except COMError: | ||
| log.exception("Can't scroll") | ||
| pass |
There was a problem hiding this comment.
This line is unnecessary.
… possible. Specifically: * TextInfos.TextInfo: Added ScrollIntoView method (no default implementation) * Implemented ScrollIntoView for UIA, IAccessible2, MS Word (object model), base VirtualBuffer class. * treeInterceptorHandler.RootProxyTextInfo: expose ScrollIntoView method which forwards to the innerTextInfo's implementation. * BrowseModeDocument._set_selection: Call ScrollIntoView on the given textInfo, rather than its deepest object. this is more accurate. # Please enter the commit message for your changes. Lines starting
38a7b5a to
113af59
Compare
…ther than error as this could happen a lot in Outline view apparently.
60a120b to
9b121c8
Compare
See test results for failed build of commit 3fbcb02018 |
| if not obj: | ||
| return | ||
| if obj == self.obj.rootNVDAObject: | ||
| # However never scroll to the document itself | ||
| return |
There was a problem hiding this comment.
Should these cases be logged? if not obj used to be
…og a debug warning if there is an invalid NVDAObject at start.
|
I added back the logging for `not obj` but, the equal to rootNVDAObject
should not be logged as this is very common and deliberately should be
ignored.
|
|
Ah, a pity I missed this. There seems to be some overlap with #9919 which I abandoned. Some thoughts:
@michaelDCurran I assume you didn't know about #9919. May be it could be helpful to have a look at it and see what can be incorporated? |
|
Ah sorry, I totally missed #9919.
It seems to be more complete. I'll take a proper look and decide what to do.
|
|
@LeonarddeR Although #9919 is much more complete, I believe this pr is enough of a subset for what is required for MS Word with UIA to scroll, without breaking anything else. |
Link to issue number:
Fixes #9611
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:
textInfos.TextInfowhich should croll the document containing that range such that the range is visible on screen. The base implementation has no implementation and does nothing._set_selectionto call ScrollIntoView on the given textInfo, rather than the deepest object at the position of that textInfo. This is much more accurate and will ensure that any arbitrary textRange is scrolled to. It is specifically this change, plus the implementation of ScrollIntoView for UIA TextInfo that solves the Microsoft Word with Browse mode via UI Automation scrolling issue.Testing strategy:
Try build: https://ci.appveyor.com/api/buildjobs/bsjf2a8c6t9879wf/artifacts/output%2Fnvda_snapshot_try-i9611-23673%2C38a7b5ac.exe
@Qchristensen has confirmed this pr fixes #9611 and that it does not cause regressions in any other browse mode implementation (Firefox, Chrome etc).
Known issues with pull request:
None known.
Change log entries:
Bug fixes:
Code Review Checklist: