Repository: nvaccess/nvda

Issue:
Word: Report 'unsupported' when pressing NVDA+V in browse mode
### Steps to reproduce

1. Open an existing or a new Microsoft Word document.
2. Press NVDA+Space to switch to browse mode.
3. In hopes of toggling screen layout, press NVDA+V.

### Expected Result
NVDA should announce ‘not supported in this document’. As is done for unsupported quick navigation commands.

### Actual Result 
The letter ‘v’ is spoken and inputted.

### Using
- installed copy of NVDA 2017.2
- Microsoft Office Word 2010
- Windows 8.1


Discussion:
I can reproduce this with NVDA version `next-14119,12ebc150` using Word 2010 on Windows 10 `1703`

You can toggle this feature via the Browse mode settings dialog. Here it mentions "Use screen layout (when supported)", I would guess that in Microsoft Word screen layout is not supported.

As you mentioned it would be nice if NVDA reported that screen layout is not supported when trying to toggle it via this shortcut. I think we need to clarify what the request is. Is the request to support screen layout in MS Word, or is the request to better handle attempts to toggle unsupported features?
Potentially it is both, however in that case could please open them as two github issues?
My current request with regards to the NVDA+V shortcut is to either
support toggling of screen layout in Microsoft Word's browse mode
implementation, or report 'not supported in this document'.
Undoubtedly, the former would be preferable, and I cannot think why a
toggle option for screen layout in Word would be any less useful than
on web browsers. However, if there are conceptual/technical challenges
deterring such an improvement, NVDA, at the very least, should report
the lack of support for screen layout. Your second interpretation was
not what I intended to convey. Hope that clarifies a little.

On 6/19/17, Reef Turner <notifications@github.com> wrote:
> I can reproduce this with NVDA version `next-14119,12ebc150` using Word 2010
> on Windows 10 `1703`
>
> You can toggle this feature via the Browse mode settings dialog. Here it
> mentions "Use screen layout (when supported)", I would guess that in
> Microsoft Word screen layout is not supported.
>
> As you mentioned it would be nice if NVDA reported that screen layout is not
> supported when trying to toggle it via this shortcut. I think we need to
> clarify what the request is. Is the request to support screen layout in MS
> Word, or is the request to better handle attempts to toggle unsupported
> features?
> Potentially it is both, however in that case could please open them as two
> github issues?
>
> --
> You are receiving this because you authored the thread.
> Reply to this email directly or view it on GitHub:
> https://github.com/nvaccess/nvda/issues/7297#issuecomment-309398986


-- 
Best Regards
Bhavya Shah

Blogger at Hiking Across Horizons: https://bhavyashah125.wordpress.com/

Contacting Me
E-mail Address: bhavya.shah125@gmail.com
Follow me on Twitter @BhavyaShah125 or www.twitter.com/BhavyaShah125
Mobile Number: +91 7506221750

It's not possible to not support screen layout in word. It's always on (It
is what it is for things that don't use a buffer, Word, Kindle, and Edge
currently). maybe for any document not using a buffer we have a
"screenLayoutSupported" attribute that is default False, and buffers set it
to True.

On Mon, Jun 19, 2017 at 4:43 AM, bhavyashah <notifications@github.com>
wrote:

> My current request with regards to the NVDA+V shortcut is to either
> support toggling of screen layout in Microsoft Word's browse mode
> implementation, or report 'not supported in this document'.
> Undoubtedly, the former would be preferable, and I cannot think why a
> toggle option for screen layout in Word would be any less useful than
> on web browsers. However, if there are conceptual/technical challenges
> deterring such an improvement, NVDA, at the very least, should report
> the lack of support for screen layout. Your second interpretation was
> not what I intended to convey. Hope that clarifies a little.
>
> On 6/19/17, Reef Turner <notifications@github.com> wrote:
> > I can reproduce this with NVDA version `next-14119,12ebc150` using Word
> 2010
> > on Windows 10 `1703`
> >
> > You can toggle this feature via the Browse mode settings dialog. Here it
> > mentions "Use screen layout (when supported)", I would guess that in
> > Microsoft Word screen layout is not supported.
> >
> > As you mentioned it would be nice if NVDA reported that screen layout is
> not
> > supported when trying to toggle it via this shortcut. I think we need to
> > clarify what the request is. Is the request to support screen layout in
> MS
> > Word, or is the request to better handle attempts to toggle unsupported
> > features?
> > Potentially it is both, however in that case could please open them as
> two
> > github issues?
> >
> > --
> > You are receiving this because you authored the thread.
> > Reply to this email directly or view it on GitHub:
> > https://github.com/nvaccess/nvda/issues/7297#issuecomment-309398986
>
>
> --
> Best Regards
> Bhavya Shah
>
> Blogger at Hiking Across Horizons: https://bhavyashah125.wordpress.com/
>
> Contacting Me
> E-mail Address: bhavya.shah125@gmail.com
> Follow me on Twitter @BhavyaShah125 or www.twitter.com/BhavyaShah125
> Mobile Number: +91 7506221750 <+91%2075062%2021750>
>
> —
> 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/7297#issuecomment-309404069>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/AFGiva1hMdlcHAo53xJZg9n1pPhrS1stks5sFlC9gaJpZM4N9P8a>
> .
>



-- 

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>

After talking to Mick about this, it seems it is possible to support "non screen layout" in word, however it would be a lot of work and is considered fairly low priority. Since it would be a fairly small amount of work to report that the feature is not supported (as we do with unsupported quick navigation commands) I will morph this issue into an issue requesting that.

@bhavyashah If you are still interested in making a case a for "non screen layout" in word, please could you open another issue. In order to try to set the priority on this new issue, can you try to explain a case where you would be likely to see a lot of links or graphics all on the one line? On the web this is likely to be seen in a navigation bar, but I think this is unlikely to be seen in a word document.
I am fine with non-screen layout remaining unsupported. While
non-screen layout would be nice to have in the future, at least as a
temporary fix, a clear prompt trapping the command as well as
reporting its lack of support would suffice.

On 6/20/17, Reef Turner <notifications@github.com> wrote:
> After talking to Mick about this, it seems it is possible to support "non
> screen layout" in word, however it would be a lot of work and is considered
> fairly low priority. Since it would be a fairly small amount of work to
> report that the feature is not supported (as we do with unsupported quick
> navigation commands) I will morph this issue into an issue requesting that.
>
> @bhavyashah If you are still interested in making a case a for "non screen
> layout" in word, please could you open another issue. In order to try to set
> the priority on this new issue, can you try to explain a case where you
> would be likely to see a lot of links or graphics all on the one line? On
> the web this is likely to be seen in a navigation bar, but I think this is
> unlikely to be seen in a word document.
>
> --
> You are receiving this because you were mentioned.
> Reply to this email directly or view it on GitHub:
> https://github.com/nvaccess/nvda/issues/7297#issuecomment-309640637


-- 
Best Regards
Bhavya Shah

Blogger at Hiking Across Horizons: https://bhavyashah125.wordpress.com/

Contacting Me
E-mail Address: bhavya.shah125@gmail.com
Follow me on Twitter @BhavyaShah125 or www.twitter.com/BhavyaShah125
Mobile Number: +91 7506221750

To add, as mentioned in #5596, which happens to be a duplicate, it is worth documenting somewhere that browse mode in MS Word and other Office applications excludes non-screen layout. This, or the other ticket should also be closed as a duplicate. @leonardder @michaelDCurran @feerrenrut 
@feerrenrut Do you think this bug might be good for new developers? If this is indeed so, as it seems from your comments as well, feel free to add the corresponding label.
P.S. I am merely going through all of the open issues in which I am mentioned to see what has been going on in these past several months.
The "quick fix" label was added in response to your comment:

> at least as a temporary fix, a clear prompt trapping the command as well as reporting its lack of support would suffice.

Blocking the command in this situation, and showing a prompt with a clear message to the use. This should be fairly quick to implement, but I'm not sure it would be good for new developers. There are some complicated things to consider.

Resolving patch:
diff --git a/source/browseMode.py b/source/browseMode.py
--- a/source/browseMode.py
+++ b/source/browseMode.py
@@ -23,7 +23,7 @@
 import gui
 import ui
 import cursorManager
-from scriptHandler import isScriptWaiting, willSayAllResume
+from scriptHandler import script, isScriptWaiting, willSayAllResume
 import aria
 import controlTypes
 from controlTypes import OutputReason
@@ -1860,3 +1860,14 @@ def _iterNotLinkBlock(self, direction="next", pos=None):
 		"kb:shift+,": "moveToStartOfContainer",
 		"kb:,": "movePastEndOfContainer",
 	}
+
+	@script(
+		description=_(
+			# Translators: the description for the toggleScreenLayout script.
+			"Toggles on and off if the screen layout is preserved while rendering the document content"
+		),
+		gesture="kb:NVDA+v",
+	)
+	def script_toggleScreenLayout(self, gesture):
+		# Translators: The message reported for not supported toggling of screen layout
+		ui.message(_("Not supported in this document."))
diff --git a/source/virtualBuffers/__init__.py b/source/virtualBuffers/__init__.py
--- a/source/virtualBuffers/__init__.py
+++ b/source/virtualBuffers/__init__.py
@@ -16,7 +16,7 @@
 import NVDAHelper
 import XMLFormatting
 import scriptHandler
-from scriptHandler import isScriptWaiting, willSayAllResume
+from scriptHandler import script
 import speech
 import NVDAObjects
 import api
@@ -539,6 +539,13 @@ def script_refreshBuffer(self,gesture):
 	# Translators: the description for the refreshBuffer script on virtualBuffers.
 	script_refreshBuffer.__doc__ = _("Refreshes the document content")
 
+	@script(
+		description=_(
+			# Translators: the description for the toggleScreenLayout script on virtualBuffers.
+			"Toggles on and off if the screen layout is preserved while rendering the document content"
+		),
+		gesture="kb:NVDA+v",
+	)
 	def script_toggleScreenLayout(self,gesture):
 		config.conf["virtualBuffers"]["useScreenLayout"]=not config.conf["virtualBuffers"]["useScreenLayout"]
 		if config.conf["virtualBuffers"]["useScreenLayout"]:
@@ -547,8 +554,6 @@ def script_toggleScreenLayout(self,gesture):
 		else:
 			# Translators: Presented when use screen layout option is toggled.
 			ui.message(_("Use screen layout off"))
-	# Translators: the description for the toggleScreenLayout script on virtualBuffers.
-	script_toggleScreenLayout.__doc__ = _("Toggles on and off if the screen layout is preserved while rendering the document content")
 
 	def _searchableAttributesForNodeType(self,nodeType):
 		pass
@@ -724,5 +729,4 @@ def _isNVDAObjectInApplication_noWalk(self, obj):
 
 	__gestures = {
 		"kb:NVDA+f5": "refreshBuffer",
-		"kb:NVDA+v": "toggleScreenLayout",
 	}


Test patch: