New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UIA can return None for currentAccessKey #6779

Closed
dkager opened this Issue Jan 22, 2017 · 6 comments

Comments

Projects
None yet
3 participants
@dkager
Collaborator

dkager commented Jan 22, 2017

Log:

ERROR - eventHandler.executeEvent (17:01:45):
error executing event: gainFocus on <NVDAObjects.Dynamic_UIADesktopWindowNVDAObject object at 0x04D832D0> with extra args of {}
Traceback (most recent call last):
  File "eventHandler.pyc", line 143, in executeEvent
  File "eventHandler.pyc", line 91, in __init__
  File "eventHandler.pyc", line 98, in next
  File "NVDAObjects\__init__.pyc", line 892, in event_gainFocus
  File "NVDAObjects\__init__.pyc", line 804, in reportFocus
  File "speech.pyc", line 355, in speakObject
  File "speech.pyc", line 272, in speakObjectProperties
  File "baseObject.pyc", line 34, in __get__
  File "baseObject.pyc", line 110, in _getPropertyViaCache
  File "NVDAObjects\UIA\__init__.pyc", line 772, in _get_keyboardShortcut
TypeError: cannot concatenate 'str' and 'NoneType' objects

Re: #6025

@jcsteh

This comment has been minimized.

Show comment
Hide comment
@jcsteh

jcsteh Jan 22, 2017

Contributor

I think I've seen this, but I don't recall where. Can you give reliable steps to reproduce this? It'd help in prioritising this issue. Thanks.

Contributor

jcsteh commented Jan 22, 2017

I think I've seen this, but I don't recall where. Can you give reliable steps to reproduce this? It'd help in prioritising this issue. Thanks.

@dkager

This comment has been minimized.

Show comment
Hide comment
@dkager

dkager Jan 23, 2017

Collaborator

I think it occurs when a new window is opened, such as after you use Alt+Tab. I also think I saw it when working with the context menu in Windows Explorer. But it is hard to pinpoint because in both scenarios the individual steps you take are usually close together.

I'd say low priority, but also trivial to catch this error. It feels like it's too small to do a PR, unless it needs deep, contemplative, philosophically sound analysis. But IMO it's just a corner case. :)

Collaborator

dkager commented Jan 23, 2017

I think it occurs when a new window is opened, such as after you use Alt+Tab. I also think I saw it when working with the context menu in Windows Explorer. But it is hard to pinpoint because in both scenarios the individual steps you take are usually close together.

I'd say low priority, but also trivial to catch this error. It feels like it's too small to do a PR, unless it needs deep, contemplative, philosophically sound analysis. But IMO it's just a corner case. :)

@josephsl

This comment has been minimized.

Show comment
Hide comment
@josephsl

josephsl Jan 24, 2017

Collaborator

Hi,

A reliable way to reproduce this:

  1. Open Outlook 2016.
  2. Turn off simple review mode.
  3. Move navigator object to the foreground window.
  4. Move through the top-level children until you hear an error sound.

CC @mohammad-suliman

Thanks.

Collaborator

josephsl commented Jan 24, 2017

Hi,

A reliable way to reproduce this:

  1. Open Outlook 2016.
  2. Turn off simple review mode.
  3. Move navigator object to the foreground window.
  4. Move through the top-level children until you hear an error sound.

CC @mohammad-suliman

Thanks.

@josephsl

This comment has been minimized.

Show comment
Hide comment
@josephsl

josephsl Jan 24, 2017

Collaborator

Hi,

Technical: no check for NULL string (None). A naive fix is to just catch type error exception. There is a related issue where two spaces are added if accelerator key is not there (#6790). The PR will catch both.

Thanks.

Collaborator

josephsl commented Jan 24, 2017

Hi,

Technical: no check for NULL string (None). A naive fix is to just catch type error exception. There is a related issue where two spaces are added if accelerator key is not there (#6790). The PR will catch both.

Thanks.

josephsl added a commit to josephsl/nvda that referenced this issue Jan 24, 2017

UIA keyboard shortcut solutions, including concatenation error and no…
… longer adding two spaces blindly if access key is there but accelerator isnt. re nvaccess#6779, nvaccess#6790.

For 6779: there's no check for the case where access key may return NULL (None), thus take care of this by forcefully setting access key to an empty string.
For 6790: don't add two spaces blindly if access key is there but accelerator isn't - keyboard shortcut is queried not only in Visual Studio, but also in other programs such as Outlook and many others.
Overall code: made it more Pythonic (for instance, using str.join instead of string concatenation).

josephsl added a commit to josephsl/nvda that referenced this issue Jan 25, 2017

UIA obj.keyboardShortcut: build keyboard shortucts list early for rea…
…dability, catch rare cases where access key itself could be NULL. re nvaccess#6779, nvaccess#6790.

Reviewed by Jamie Teh 9NV Access): build keyboard shortcuts list early for readability. Also, take care of rare situations where access key itself could return NULL (None).

josephsl added a commit to josephsl/nvda that referenced this issue Jan 25, 2017

UIA objects.keyboardShortcuts: readability improvements, catch attrib…
…ute error early, append to shortcuts list early. re nvaccess#6779, nvaccess#6790.

Reviewed by Jamie Teh (NV Access): we still want to catch NULL, so catch AttributeError exception early. Also, append access key and accelerator as soon as possible 9if they are even defined). Lastly, simplified the return statement to check for presence of access key and/or accelerator in the shortcuts list (len is at least 1), and return an an empty string if no info found. These changes shuld hopefully improve readability.

jcsteh added a commit that referenced this issue Mar 15, 2017

Fix errors or extraneous spaces when retrieving UIA keyboard shortcut…
…s. (PR #6992)

- NVDA will no longer fail to navigate to or report certain (UIA) controls where a keyboard shortcut is not defined. (#6779)
- Two empty spaces are no longer added in keyboard shortcut information for certain (UIA) controls. (#6790)
@dkager

This comment has been minimized.

Show comment
Hide comment
@dkager

dkager Apr 26, 2017

Collaborator

Did the fix not go into master already?

Collaborator

dkager commented Apr 26, 2017

Did the fix not go into master already?

@jcsteh

This comment has been minimized.

Show comment
Hide comment
@jcsteh

jcsteh Apr 26, 2017

Contributor

Yes; #6792 got merged. Closing.

Contributor

jcsteh commented Apr 26, 2017

Yes; #6792 got merged. Closing.

@jcsteh jcsteh closed this Apr 26, 2017

@jcsteh jcsteh added this to the 2017.2 milestone Apr 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment