nvda icon indicating copy to clipboard operation
nvda copied to clipboard

Text style navigation: Runtime error, NVDA cannot find desired offset in textInfo when using tables in MS Word with UIA disabled

Open Adriani90 opened this issue 3 months ago • 5 comments

Steps to reproduce:

  1. Open NVDA
  2. Assign [ and shift+[ for different style navigation
  3. Assign ] and shift+] for same style navigation
  4. Open an MS Word document with different text formats, where headings are indicated by text font size instead of heading levels, and tables are used to structure content, see attached document for a test case.
  5. Make sure UIA for MS Word is disabled in NVDA advanced settings
  6. Navigate to a heading (e.g. professional background), and Press the assigned commands for navigating to next and previous text styles

Actual behavior:

NVDA stops navigating, and the focus does not move. Following is written to the log:

IO - inputCore.InputManager.executeGesture (17:26:53.868) - winInputHook (18680):
Input: kb(laptop):plus
DEBUG - watchdog._waitUntilNormalCoreAliveTimeout (17:26:54.378) - watchdog (1936):
Potential freeze, waiting up to 10 seconds.
IO - speech.speech.speak (17:26:55.140) - MainThread (22192):
Speaking ['Academic experience\n']
DEBUG - UIAHandler.shouldUseUIAInMSWord (17:26:55.167) - MainThread (22192):
User does not want UIA in MS Word unless necessary
DEBUG - watchdog._waitUntilNormalCoreAliveTimeout (17:26:55.380) - watchdog (1936):
Recovered from potential freeze after 1.502466700000241 seconds.
IO - inputCore.InputManager.executeGesture (17:26:55.663) - winInputHook (18680):
Input: kb(laptop):shift+ü
ERROR - scriptHandler.executeScript (17:26:55.780) - MainThread (22192):
error executing script: <bound method BrowseModeTreeInterceptor.addQuickNav.<locals>.<lambda> of <NVDAObjects.window.winword.WordDocumentTreeInterceptor object at 0x0664D430>> with gesture 'Umschalt+ü'
Traceback (most recent call last):
  File "scriptHandler.pyc", line 295, in executeScript
  File "browseMode.pyc", line 567, in <lambda>
  File "browseMode.pyc", line 516, in _quickNavScript
  File "browseMode.pyc", line 2405, in _iterTextStyle
  File "browseMode.pyc", line 2326, in _expandStyle
  File "textInfos\__init__.pyc", line 793, in moveToCodepointOffset
RuntimeError: Unable to find desired offset in TextInfo.
IO - inputCore.InputManager.executeGesture (17:26:56.484) - winInputHook (18680):
Input: kb(laptop):plus
DEBUG - watchdog._waitUntilNormalCoreAliveTimeout (17:26:56.991) - watchdog (1936):
Potential freeze, waiting up to 10 seconds.
IO - speech.speech.speak (17:26:57.112) - MainThread (22192):
Speaking ['Seite 2', 'Projects and initiatives\n']
DEBUG - UIAHandler.shouldUseUIAInMSWord (17:26:57.128) - MainThread (22192):
User does not want UIA in MS Word unless necessary
DEBUG - watchdog._waitUntilNormalCoreAliveTimeout (17:26:57.492) - watchdog (1936):
Recovered from potential freeze after 1.0022185000002537 seconds.
IO - inputCore.InputManager.executeGesture (17:26:57.712) - winInputHook (18680):
Input: kb(laptop):shift+ü
ERROR - scriptHandler.executeScript (17:26:57.997) - MainThread (22192):
error executing script: <bound method BrowseModeTreeInterceptor.addQuickNav.<locals>.<lambda> of <NVDAObjects.window.winword.WordDocumentTreeInterceptor object at 0x0664D430>> with gesture 'Umschalt+ü'
Traceback (most recent call last):
  File "scriptHandler.pyc", line 295, in executeScript
  File "browseMode.pyc", line 567, in <lambda>
  File "browseMode.pyc", line 516, in _quickNavScript
  File "browseMode.pyc", line 2461, in _iterTextStyle
  File "browseMode.pyc", line 2326, in _expandStyle
  File "textInfos\__init__.pyc", line 793, in moveToCodepointOffset
RuntimeError: Unable to find desired offset in TextInfo.
IO - inputCore.InputManager.executeGesture (17:26:58.921) - winInputHook (18680):
Input: kb(laptop):shift+plus
DEBUG - watchdog._waitUntilNormalCoreAliveTimeout (17:26:59.422) - watchdog (1936):
Potential freeze, waiting up to 10 seconds.
ERROR - scriptHandler.executeScript (17:26:59.518) - MainThread (22192):
error executing script: <bound method BrowseModeTreeInterceptor.addQuickNav.<locals>.<lambda> of <NVDAObjects.window.winword.WordDocumentTreeInterceptor object at 0x0664D430>> with gesture 'Umschalt+plus'
Traceback (most recent call last):
  File "scriptHandler.pyc", line 295, in executeScript
  File "browseMode.pyc", line 567, in <lambda>
  File "browseMode.pyc", line 516, in _quickNavScript
  File "browseMode.pyc", line 2461, in _iterTextStyle
  File "browseMode.pyc", line 2326, in _expandStyle
  File "textInfos\__init__.pyc", line 793, in moveToCodepointOffset
RuntimeError: Unable to find desired offset in TextInfo.

Expected behavior:

Navigation should continue, e.g. within the tables or skipping the tables.

NVDA logs, crash dumps and other attachments:

n/a

System configuration

NVDA installed/portable/running from source:

Installed

NVDA version:

alpha-31645,bf96860d (2024.2.0.31645)

Windows version:

Windows 11 23 H2

Name and version of other software in use when reproducing the issue:

MS Office Word 365 MSO (Version 2403 Build 16.0.17425.20176) 64 Bit

Other information about your system:

n/a

Other questions

Does the issue still occur after restarting your computer?

yes

Have you tried any other versions of NVDA? If so, please report their behaviors.

n/a

If NVDA add-ons are disabled, is your problem still occurring?

No add-ons in use

Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?

yes Summary-with-table-test-case.docx

Adriani90 avatar Apr 28 '24 15:04 Adriani90

cc: @mltony is this maybe related to #16448?

Adriani90 avatar Apr 28 '24 15:04 Adriani90

This ssems to work properly when UIA is enabled.

Adriani90 avatar Apr 28 '24 15:04 Adriani90

  1. Navigate to a heading (e.g. professional background)

There is no such text in the attached document. I assume you meant "Professional experience". But having said that, for some reason your issue doesn't repro on my computer. Just to clarify, when you say

Make sure UIA for MS Word is disabled in NVDA advanced settings

I only have this option:

Use UI Automation to access Microsoft Word document controls:
Only when necessary

mltony avatar Apr 29 '24 22:04 mltony

Yes only when necessary is the value I was refering too.Did you try to navigate back and forth between the headings? E.g. until the last heading and back to the first via same style navigation for example?I definitely reproduce this on several machines.Von meinem iPhone gesendetAm 30.04.2024 um 00:36 schrieb mltony @.***>:

Navigate to a heading (e.g. professional background)

There is no such text in the attached document. I assume you meant "Professional experience". But having said that, for some reason your issue doesn't repro on my computer. Just to clarify, when you say

Make sure UIA for MS Word is disabled in NVDA advanced settings

I only have this option: Use UI Automation to access Microsoft Word document controls: Only when necessary

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

Adriani90 avatar Apr 30 '24 03:04 Adriani90

Yes, I confirm I can navigate back and forth between headings with styleNav commands. Navigate to different style also works as expected. I just tested on my other laptop running Windows 10 - same experience there.

mltony avatar Apr 30 '24 20:04 mltony

Did you make sure UIA is set to "only necessary" for MS Word? Which MS Word version are you using?

For what I can say, for me style navigation does not really work in this example document at ll. I get this in the log:

IO - inputCore.InputManager.executeGesture (11:59:36.181) - winInputHook (18700):
Input: kb(laptop):ü
ERROR - scriptHandler.executeScript (11:59:36.431) - MainThread (2304):
error executing script: <bound method BrowseModeTreeInterceptor.addQuickNav.<locals>.<lambda> of <NVDAObjects.window.winword.WordDocumentTreeInterceptor object at 0x06128390>> with gesture 'ü'
Traceback (most recent call last):
  File "scriptHandler.pyc", line 295, in executeScript
  File "browseMode.pyc", line 558, in <lambda>
  File "browseMode.pyc", line 516, in _quickNavScript
  File "browseMode.pyc", line 2447, in _iterTextStyle
  File "textInfos\__init__.pyc", line 793, in moveToCodepointOffset
RuntimeError: Unable to find desired offset in TextInfo.
IO - inputCore.InputManager.executeGesture (11:59:38.996) - winInputHook (18700):
Input: kb(laptop):shift+plus
DEBUG - watchdog._waitUntilNormalCoreAliveTimeout (11:59:39.496) - watchdog (24592):
Potential freeze, waiting up to 10 seconds.
ERROR - scriptHandler.executeScript (11:59:39.581) - MainThread (2304):
error executing script: <bound method BrowseModeTreeInterceptor.addQuickNav.<locals>.<lambda> of <NVDAObjects.window.winword.WordDocumentTreeInterceptor object at 0x06128390>> with gesture 'Umschalt+plus'
Traceback (most recent call last):
  File "scriptHandler.pyc", line 295, in executeScript
  File "browseMode.pyc", line 567, in <lambda>
  File "browseMode.pyc", line 516, in _quickNavScript
  File "browseMode.pyc", line 2461, in _iterTextStyle
  File "browseMode.pyc", line 2326, in _expandStyle
  File "textInfos\__init__.pyc", line 793, in moveToCodepointOffset
RuntimeError: Unable to find desired offset in TextInfo.
DEBUG - watchdog._waitUntilNormalCoreAliveTimeout (11:59:39.997) - watchdog (24592):
Recovered from potential freeze after 1.000924300024053 seconds.

Note: if you restart NVDA while the document is focused the object model will not be available and UIA will be used although it is set to "only when necessary". Alt+tabbing away and back to the document makes sure you are using object model.

cc: @CyrilleB79 or @lukaszgo1 can you test as well?

Adriani90 avatar May 01 '24 10:05 Adriani90

Did you make sure UIA is set to "only necessary" for MS Word?>

Yes.

appModule.productName: 'Microsoft Office' appModule.productVersion: '16.0.17425.20176'

I tried restarting NVDA and Alt-tabbing back and forth and still cannot reproduce this.

mltony avatar May 01 '24 17:05 mltony

@burmancomp, @cary-rowen could you please test if you have this issue with UIA set to "only when necessary" for MS Word in NVDA advanced settings? This would help allot. ON my end I cannot use this feature unfortunately. @mltony any suggestions how I can solve this on my end?

Adriani90 avatar May 03 '24 15:05 Adriani90