Repository: nvaccess/nvda

Issue:
Firefox: NVDA reads aria-hidden divs as section when they are ancestors of the focus
As we are using many YUI widgets and custom events/event handlers, we made our HTML body as role='application'. But, when we focus on an element it starts reading section multiple times (it is reading section for all parents of the focused element). And also when an overlay is opened, NVDA starts reading - <web page title>, document, <web page title>.



Discussion:
If NVDA is reading "section" multiple times, that suggests that you're 
focusing multiple divs in quick succession. As for "document", that will 
be read if content gets focused inside of a document, which is certainly 
expected. We need more thorough details or a test case in order to 
provide any further info.

I found the cause of this issue of reading "section". When overlay is opened was setting aria-hidden="true" to the overlay itself instead of other(non-overlay) child elements of body. But didn't understand that, why even after setting aria-hidden="true" NVDA was reading all the text?

Sorry; there's literally nothing we can do here without a minimal test 
case. Please provide one if you want someone to look into this. Thanks.

If we focus a div which is not sibling of currently focused div & it is grandchild of sibling of currently focused div, then NVDA is reading "section" for twice for 2 parent div present. So how can I fix this issue. This time I'm not focusing over each divs coming in the way in quick succession. If this is due to browser's default behavior, please provide a solution for that.
Please provide a minimal test case. We cannot provide any further information without one. Thanks.
I see this on twitter, but have no clue why. I just Hear "section " over
and over basically.

On Thu, Jun 29, 2017 at 6:38 PM, James Teh <notifications@github.com> wrote:

> Please provide a minimal test case. We cannot provide any further
> information without one. Thanks.
>
> —
> 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/5741#issuecomment-312144139>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/AFGivQ63-ClAn9QkSa7NNyK7RjJUgUq-ks5sJEOIgaJpZM4HYL1L>
> .
>



-- 

Derek Riemer: Improving the world one byte at a time!

   - University of Colorado Boulder Department of computer science, 4th
   year undergraduate student.
   - Accessibility enthusiast.
   - Proud user of the NVDA screen reader.
   - Open source enthusiast.
   - Skier.

Personal website <http://derekriemer.com>

[nvda section.txt](https://github.com/nvaccess/nvda/files/1121228/nvda.section.txt)

@jcsteh 
Try attached html in **firefox** with nvda. Issue it not present for role application, it is replicated for aria-hidden="true".
While **aria-hidden="true"** is given to any div, (inside that div) nvda reads **"section"** for each div coming their way while focusing some **control element**.
How can we fix this issue?

You also can refer below link:
https://codepen.io/kevindhadukzs/pen/XgqBem

Resolving patch:
diff --git a/source/NVDAObjects/__init__.py b/source/NVDAObjects/__init__.py
--- a/source/NVDAObjects/__init__.py
+++ b/source/NVDAObjects/__init__.py
@@ -793,7 +793,7 @@ def _get_isPresentableFocusAncestor(self):
 		@return: C{True} if it should be presented in the focus ancestry, C{False} if not.
 		@rtype: bool
 		"""
-		if self.presentationType == self.presType_layout:
+		if self.presentationType in (self.presType_layout, self.presType_unavailable):
 			return False
 		if self.role in (controlTypes.ROLE_TREEVIEWITEM, controlTypes.ROLE_LISTITEM, controlTypes.ROLE_PROGRESSBAR, controlTypes.ROLE_EDITABLETEXT):
 			return False
diff --git a/source/appModules/nvda.py b/source/appModules/nvda.py
--- a/source/appModules/nvda.py
+++ b/source/appModules/nvda.py
@@ -1,6 +1,6 @@
 #appModules/nvda.py
 #A part of NonVisual Desktop Access (NVDA)
-#Copyright (C) 2008-2011 NV Access Inc
+#Copyright (C) 2008-2017 NV Access Limited
 #This file is covered by the GNU General Public License.
 #See the file COPYING for more details.
 
@@ -14,6 +14,20 @@
 
 nvdaMenuIaIdentity = None
 
+class NvdaDialog(IAccessible):
+	"""Fix to ensure NVDA message dialogs get reported when they pop up.
+	"""
+
+	def _get_presentationType(self):
+		presType = super(NvdaDialog, self).presentationType
+		# Sometimes, NVDA message dialogs briefly report the invisible state
+		# after they're focused.
+		# This causes them to be treated as unavailable and they are thus not reported.
+		# If this dialog is in the foreground, treat it as content.
+		if presType == self.presType_unavailable and self == api.getForegroundObject():
+			return self.presType_content
+		return presType
+
 class AppModule(appModuleHandler.AppModule):
 
 	def isNvdaMenu(self, obj):
@@ -48,3 +62,7 @@ def event_foreground         (self, obj, nextHandler):
 		if not gui.shouldConfigProfileTriggersBeSuspended():
 			config.conf.resumeProfileTriggers()
 		nextHandler()
+
+	def chooseNVDAObjectOverlayClasses(self, obj, clsList):
+		if obj.windowClassName == "#32770" and obj.role == controlTypes.ROLE_DIALOG:
+			clsList.insert(0, NvdaDialog)


Test patch: