Repository: nvaccess/nvda

Issue:
Additional list numbers read when navigating a list in Word with UIA
<!--
Please thoroughly read NVDA's wiki article on how to fill in this template, including how to provide the required files.
Issues may be closed if the required information is not present.
https://github.com/nvaccess/nvda/wiki/Github-issue-template-explanation-and-examples
-->

### Steps to reproduce:

1. Turn NVDA's UIA in Word option on.  Open Word 365 to a blank document.
2. Type: 1. The first
3. Press enter and for list item 2 type "the second".
4. Press UP ARROW.
5. Press LEFT ARROW
6. Press RIGHT ARROW four times.

### Actual behavior:

A) At Step 4, NVDA reads "1. The first 2"
B) At Step 5 (left arrow), NVDA reads "T".
C) At step 6, NVDA reads "2", then "2. T", then "2. T", then "h"

### Expected behavior:
A) NVDA should read "1. The first" (without reading 2)
B) This step is correct.
C) NVDA should read "linefeed", "2", "T", "h"

### System configuration
#### NVDA installed/portable/running from source:

#### NVDA version:
NVDA 2019.1.1 installed
nvda_snapshot_alpha-17311,0d29265e

#### Windows version:
Windows 10 18362.1 
#### Name and version of other software in use when reproducing the issue:
Office 365 Version: 
16.0.11601.20184 

#### Other information about your system:

### Other questions
#### Does the issue still occur after restarting your PC?
Yes

#### Have you tried any other versions of NVDA? If so, please report their behaviors.



Discussion:
This has been an issue for a while now. While UIA is still not the default implementation, this is a major show stopper from using it, therefore assigning it p2, at least to investigate what the problem is.

@michaelDCurran Any ideas where to start looking?
HI,

The same is with the UIA and comments.

Has somebody reviewed the PR related to comments?

When it comes to these nasty spurious list reporting, I can reproduce it even in word 2019 and outlook 2019. 

 

 

From: Leonard de Ruijter <notifications@github.com> 
Sent: Monday, October 28, 2019 8:14 AM
To: nvaccess/nvda <nvda@noreply.github.com>
Cc: Subscribed <subscribed@noreply.github.com>
Subject: Re: [nvaccess/nvda] Additional list numbers read when navigating a list in Word with UIA (#9613)

 

This has been an issue for a while now. While UIA is still not the default implementation, this is a major show stopper from using it, therefore assigning it p2, at least to investigate what the problem is.

@michaelDCurran <https://github.com/michaelDCurran>  Any ideas where to start looking?

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <https://github.com/nvaccess/nvda/issues/9613?email_source=notifications&email_token=ACVCDEZKLYFXNK6OK3PISQLQQ2GLBA5CNFSM4HO2N57KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECL5DYY#issuecomment-546820579> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/ACVCDE5F3FVCQ3P3Y6U67DTQQ2GLBANCNFSM4HO2N57A> .  <https://github.com/notifications/beacon/ACVCDE6DL4M2U5RG3Z4ETPLQQ2GLBA5CNFSM4HO2N57KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECL5DYY.gif> 



Resolving patch:
diff --git a/source/UIAUtils.py b/source/UIAUtils.py
--- a/source/UIAUtils.py
+++ b/source/UIAUtils.py
@@ -126,6 +126,11 @@ def iterUIARangeByUnit(rangeObj,unit,reverse=False):
 		if pastEnd:
 			return
 		tempRange.MoveEndpointByRange(Endpoint_relativeStart,tempRange,Endpoint_relativeEnd)
+		delta = tempRange.CompareEndpoints(Endpoint_relativeStart, rangeObj, Endpoint_relativeEnd)
+		if relativeGTOperator(delta, -1):
+			# tempRange is now already entirely past the end of the given range.
+			# Can be seen with MS Word bullet points: #9613
+			return
 	# Ensure that we always reach the end of the outer range, even if the units seem to stop somewhere inside
 	if relativeLTOperator(tempRange.CompareEndpoints(Endpoint_relativeEnd,rangeObj,Endpoint_relativeEnd),0):
 		tempRange.MoveEndpointByRange(Endpoint_relativeEnd,rangeObj,Endpoint_relativeEnd)


Test patch: