Error when reading the last footnote in a Word document with page number reporting enabled

Open
#20,963 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
accessibility

Research direction

The traceback points to NVDAObjects/UIA/wordDocument.py, especially getTextWithFields and _getFormatFieldAtRange; begin by reading those paths and how page-number reporting handles the final footnote. Reproduce in Word with page number reporting enabled, then check the relevant UIA Word document tests. Done means NVDA reads the last footnote without raising an error.

Written by the indexing model from the issue text.

Description

app/microsoft-office bug component/UIA-ms-office needs-technical-investigation p3 triaged
Brief summary

When arrowing down through text and footnotes on a page, NVDA gives an error at the last footnote. At first glance, this seems like a duplicate of #19072, however the author in that issue declares that it does not happen without the Zetero plugin for Word. I can reproduce without any plugins.

Steps to reproduce
  1. Create a blank document in Word
  2. Type some text and press control+alt+f to create a footnote
  3. Type text for the footnote then arrow back up to the main document body
  4. down arrow to the footnote text.
  5. Arrow back up, add some more text and another footnote.
  6. Down arrow through the document and footnotes.
Actual behavior

At step 4, NVDA gives an error and does not read the (only) footnote.
At step 6, with multiple footnotes present, NVDA reads all but the last one.

If you add text and footnotes on multiple pages, NVDA reads everything fine, except the last footnote in the document.

Expected behavior

NVDA should read all footnotes

NVDA logs, crash dumps and other attachments

Log fragment from pressing down arrow onto the last footnote:

IO - inputCore.InputManager.executeGesture (09:30:03.881) - winInputHook (13400):
Input: kb(desktop):downArrow
DEBUG - editableText.EditableText._hasCaretMoved (09:30:03.953) - MainThread (17392):
Caret move detected using bookmarks. Elapsed 0 sec, retries 0
ERROR - scriptHandler.executeScript (09:30:04.022) - MainThread (17392):
error executing script: <bound method EditableText.script_caret_moveByLine of <NVDAObjects.Dynamic_WordDocumentNodeEditableTextWithAutoSelectDetectionUIA object at 0x0000029B3ED394F0>> with gesture 'down arrow'
Traceback (most recent call last):
  File "scriptHandler.pyc", line 293, in executeScript
  File "editableText.pyc", line 268, in script_caret_moveByLine
  File "editableText.pyc", line 192, in _caretMovementScriptHelper
  File "NVDAObjects\behaviors.pyc", line 258, in _caretScriptPostMovedHelper
  File "editableText.pyc", line 178, in _caretScriptPostMovedHelper
  File "speech\speech.pyc", line 1550, in speakTextInfo
  File "speech\types.pyc", line 45, in __iter__
  File "speech\speech.pyc", line 1590, in getTextInfoSpeech
  File "NVDAObjects\UIA\wordDocument.pyc", line 469, in getTextWithFields
  File "NVDAObjects\UIA\__init__.pyc", line 1040, in getTextWithFields
  File "NVDAObjects\UIA\__init__.pyc", line 1028, in _getTextWithFieldsForUIARange
  File "NVDAObjects\UIA\__init__.pyc", line 697, in _getTextWithFields_text
  File "NVDAObjects\UIA\wordDocument.pyc", line 619, in _getFormatFieldAtRange
  File "UIAHandler\remote.pyc", line 119, in msWord_getCustomAttributeValue
  File "UIAHandler\_remoteOps\operation.pyc", line 338, in execute
  File "UIAHandler\_remoteOps\operation.pyc", line 324, in _executeUntilSuccess
UIAHandler._remoteOps.operation.UnhandledException: 
at instruction 25: CallExtension(target=RemoteExtensionTarget at OperandId 6, extensionId=const RemoteGuid at OperandId 14, argCount=c_ulong(3), arguments=[RemoteTextRange at OperandId 4, const RemoteIntEnum at OperandId 16, RemoteVariant at OperandId 5])
extendedError -2146233079
Error occured on execution try 1
Dumping instructions:
--- Begin ---
static:
const:
0: NewGuid(result=const RemoteGuid at OperandId 8, value=GUID("{93514122-FF04-4B2C-A4AD-4AB04587C129}"))
1: NewNull(result=const RemoteNull at OperandId 10)
2: NewInt(result=const RemoteInt at OperandId 11, value=c_long(10))
3: NewGuid(result=const RemoteGuid at OperandId 14, value=GUID("{081ACA91-32F2-46F0-9FB9-017038BC45F8}"))
4: NewInt(result=const RemoteIntEnum at OperandId 16, value=c_long enum <UIACustomAttributeID.PAGE_NUMBER: 1>)
5: NewInt(result=const RemoteInt at OperandId 17, value=c_long(5))
main:
6: NewInt(result=RemoteInt at OperandId 1, value=c_long(-1))
[importElement into OperandId 2, value  <POINTER(IUIAutomationElement) ptr=0x29b41643e20 at 29b405ca350>]
[importTextRange into OperandId 3, value  <POINTER(IUIAutomationTextRange) ptr=0x29b4163d390 at 29b3f16d9d0>]
# Entering RemoteTextRange.clone(, )
7: TextRangeClone(result=RemoteTextRange at OperandId 4, target=RemoteTextRange at OperandId 3)
# Exiting RemoteTextRange.clone
8: NewNull(result=RemoteVariant at OperandId 5)
9: NewNull(result=RemoteVariant at OperandId 6)
# Entering RemoteExtensionTarget.isExtensionSupported(GUID("{93514122-FF04-4B2C-A4AD-4AB04587C129}"), )
# Using cached const RemoteGuid at OperandId 8 for constant value GUID("{93514122-FF04-4B2C-A4AD-4AB04587C129}")
10: IsExtensionSupported(result=RemoteBool at OperandId 7, target=RemoteElement at OperandId 2, extensionId=const RemoteGuid at OperandId 8)
# Exiting RemoteExtensionTarget.isExtensionSupported
# Entering RemoteBool.inverse(, )
11: BoolNot(result=RemoteBool at OperandId 9, target=RemoteBool at OperandId 7)
# Exiting RemoteBool.inverse
12: ForkIfFalse(condition=RemoteBool at OperandId 9, branch=RelativeOffset 3)
# If block body
# Using cached const RemoteNull at OperandId 10 for constant value None
# Returning const RemoteNull at OperandId 10
# Entering RemoteBaseObject.set(10, )
# Using cached const RemoteInt at OperandId 11 for constant value 10
13: Set(target=RemoteInt at OperandId 1, value=const RemoteInt at OperandId 11)
# Exiting RemoteBaseObject.set
14: Halt()
# End of if block body
# Entering RemoteExtensionTarget.callExtension(GUID("{93514122-FF04-4B2C-A4AD-4AB04587C129}"), RemoteVariant at OperandId 6, )
# Using cached const RemoteGuid at OperandId 8 for constant value GUID("{93514122-FF04-4B2C-A4AD-4AB04587C129}")
15: CallExtension(target=RemoteElement at OperandId 2, extensionId=const RemoteGuid at OperandId 8, argCount=c_ulong(1), arguments=[RemoteVariant at OperandId 6])
# Exiting RemoteExtensionTarget.callExtension
# Entering RemoteVariant.isNull(, )
16: IsNull(result=RemoteBool at OperandId 12, target=RemoteVariant at OperandId 6)
# Exiting RemoteVariant.isNull
17: ForkIfFalse(condition=RemoteBool at OperandId 12, branch=RelativeOffset 3)
# If block body
# Using cached const RemoteNull at OperandId 10 for constant value None
# Returning const RemoteNull at OperandId 10
# Entering RemoteBaseObject.set(10, )
# Using cached const RemoteInt at OperandId 11 for constant value 10
18: Set(target=RemoteInt at OperandId 1, value=const RemoteInt at OperandId 11)
# Exiting RemoteBaseObject.set
19: Halt()
# End of if block body
# Entering RemoteExtensionTarget.isExtensionSupported(GUID("{081ACA91-32F2-46F0-9FB9-017038BC45F8}"), )
# Using cached const RemoteGuid at OperandId 14 for constant value GUID("{081ACA91-32F2-46F0-9FB9-017038BC45F8}")
20: IsExtensionSupported(result=RemoteBool at OperandId 13, target=RemoteExtensionTarget at OperandId 6, extensionId=const RemoteGuid at OperandId 14)
# Exiting RemoteExtensionTarget.isExtensionSupported
# Entering RemoteBool.inverse(, )
21: BoolNot(result=RemoteBool at OperandId 15, target=RemoteBool at OperandId 13)
# Exiting RemoteBool.inverse
22: ForkIfFalse(condition=RemoteBool at OperandId 15, branch=RelativeOffset 3)
# If block body
# Using cached const RemoteNull at OperandId 10 for constant value None
# Returning const RemoteNull at OperandId 10
# Entering RemoteBaseObject.set(10, )
# Using cached const RemoteInt at OperandId 11 for constant value 10
23: Set(target=RemoteInt at OperandId 1, value=const RemoteInt at OperandId 11)
# Exiting RemoteBaseObject.set
24: Halt()
# End of if block body
# Entering RemoteExtensionTarget.callExtension(GUID("{081ACA91-32F2-46F0-9FB9-017038BC45F8}"), RemoteTextRange at OperandId 4, <UIACustomAttributeID.PAGE_NUMBER: 1>, RemoteVariant at OperandId 5, )
# Using cached const RemoteGuid at OperandId 14 for constant value GUID("{081ACA91-32F2-46F0-9FB9-017038BC45F8}")
# Using cached const RemoteIntEnum at OperandId 16 for constant value <UIACustomAttributeID.PAGE_NUMBER: 1>
25: CallExtension(target=RemoteExtensionTarget at OperandId 6, extensionId=const RemoteGuid at OperandId 14, argCount=c_ulong(3), arguments=[RemoteTextRange at OperandId 4, const RemoteIntEnum at OperandId 16, RemoteVariant at OperandId 5])
# Exiting RemoteExtensionTarget.callExtension
# Returning RemoteVariant at OperandId 5
# Entering RemoteBaseObject.set(5, )
# Using cached const RemoteInt at OperandId 17 for constant value 5
26: Set(target=RemoteInt at OperandId 1, value=const RemoteInt at OperandId 17)
# Exiting RemoteBaseObject.set
27: Halt()
28: Halt()
--- End ---
DEBUG - UIAHandler.shouldUseUIAInMSWord (09:30:04.064) - MainThread (17392):
Using UIA due to suitable Office version: (16, 0, 20430)

NVDA type

installed copy

NVDA version

2026.3 Beta 4

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

NVDA 2026.2 (Portable) - I didn't analyze the log in depth, but seemed to be same result.

Windows version

Windows 11 (64-bit) Version: 26H2, Build: 26300.9550

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

Office 365 (64-bit) Version: 16.0.20430.20092

Other information about your system

I didn't run accessibility repair tool yet, but since I was attempting to duplicate what someone else reported, and it seems to be identical, my guess it that won't change it. I'll test and add a comment if it does make a difference.

Does the issue still occur after restarting your computer?

I have not restarted my computer

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

I do not have any NVDA add-ons installed

Does the issue still occur after you run the System Accessibility Repair Tool (COM Registration Fixing Tool in older versions) in NVDA's tools menu?

I have not run the System Accessibility Repair Tool

Dominant language
Python
Stars
2.7k
Forks
842
Avg merge
2d 4h
Merged PRs (30d)
56

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nvaccess/nvda

All issues in nvaccess/nvda

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.