Repository: nvaccess/nvda

Issue:
in edge, this page will freeze NVDA forever
Note: this needs to be looked at fairly soon, as I want to change my theme back to the 2015 theme because I like its accessibility much better. I am keeping it for now so you guys can look at it
1. in edge, visit https://derekriemer.com
2. press h from the top. Note that you never reach the headings in the main landmark.
3. go to the bottom of the page.
4. press shift+h several times. Note that NVDA gets stuck in a cycle between heading level twos (Home and Derek Riemer).
5. Note that if you press shift+1, NVDA gets stuck in the infinite loop forever.

I'm sorry, I spent about half an hour trying to get this to a small test that made sense, and I couldn't get it to work on a smaller page. I don't know what is going on here.


Discussion:
Any chance this will be looked into soon? I want to change wordpress themes, should I yank this code into a separate page?
CC @MichaelDCurran. Would you be able to take a quick look at this some time soon before the test case disappears?
I promise to take a look at this tomorrow morning (my time). And  leading on from investigating this, I will change the number-specific heading quicknav code to search by attribute value of specific heading type, rather than the generalized paragraph search for all headings, as this will be faster in the specific number case.
Some further notes:
When moving down the page from the top, either with arrow keys or review cursor, after the "NVDA development" line in the "Other" submenu on the navbar, you then jump straight to the blank line above "Powered by Wordpress" at the bottom of the page. However, when moving back up, you go through all the main content. Also, if you move by character or word off the end of the "NVDA development" link, you hit another link called "scroll to content" and then you can move  into and down the main content by any means, including by line. 
As you can not get to this content moving down by line (or paragraph I assume),  the means we use to find the next heading will also fail here, thus why you cannot get to any further headings.
The loop when going previous heading with shift+h (between Home and Derek) is either a bug in NVDA or Edge - I need to investigate further, but may still be related to the above issue.

Resolving patch:
diff --git a/source/NVDAObjects/UIA/edge.py b/source/NVDAObjects/UIA/edge.py
--- a/source/NVDAObjects/UIA/edge.py
+++ b/source/NVDAObjects/UIA/edge.py
@@ -70,19 +70,22 @@ def _get_UIAElementAtStartWithReplacedContent(self):
 		condition=UIAHandler.handler.clientObject.createOrCondition(UIAHandler.handler.clientObject.createPropertyCondition(UIAHandler.UIA_RuntimeIdPropertyId,runtimeID),condition)
 		walker=UIAHandler.handler.clientObject.createTreeWalker(condition)
 		cacheRequest=UIAHandler.handler.clientObject.createCacheRequest()
+		cacheRequest.addProperty(UIAHandler.UIA_NamePropertyId)
 		cacheRequest.addProperty(UIAHandler.UIA_AriaPropertiesPropertyId)
 		element=walker.normalizeElementBuildCache(element,cacheRequest)
 		while element and not UIAHandler.handler.clientObject.compareElements(element,self.obj.UIAElement):
-			ariaProperties=element.getCachedPropertyValue(UIAHandler.UIA_AriaPropertiesPropertyId)
-			if ('label=' in ariaProperties)  or ('labelledby=' in ariaProperties):
-				return element
-			try:
-				range=self.obj.UIATextPattern.rangeFromChild(element)
-			except COMEror:
-				return
-			text=range.getText(-1)
-			if not text or text.isspace():
-				return element
+			name=element.getCachedPropertyValue(UIAHandler.UIA_NamePropertyId)
+			if name:
+				ariaProperties=element.getCachedPropertyValue(UIAHandler.UIA_AriaPropertiesPropertyId)
+				if ('label=' in ariaProperties)  or ('labelledby=' in ariaProperties):
+					return element
+				try:
+					range=self.obj.UIATextPattern.rangeFromChild(element)
+				except COMError:
+					return
+				text=range.getText(-1)
+				if not text or text.isspace():
+					return element
 			element=walker.getParentElementBuildCache(element,cacheRequest)
 
 	def _moveToEdgeOfReplacedContent(self,back=False):
@@ -96,9 +99,9 @@ def _moveToEdgeOfReplacedContent(self,back=False):
 			return
 		if not back:
 			range.MoveEndpointByRange(UIAHandler.TextPatternRangeEndpoint_Start,range,UIAHandler.TextPatternRangeEndpoint_End)
+			range.move(UIAHandler.TextUnit_Character,-1)
 		else:
 			range.MoveEndpointByRange(UIAHandler.TextPatternRangeEndpoint_End,range,UIAHandler.TextPatternRangeEndpoint_Start)
-			range.move(UIAHandler.TextUnit_Character,1)
 		self._rangeObj=range
 
 	def _collapsedMove(self,unit,direction,skipReplacedContent):


Test patch: