UIA/keyboard shortcut: do not append two spaces if access key is there but accelerator key isn't #6790

Closed
josephsl opened this Issue Jan 24, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@josephsl
Collaborator

josephsl commented Jan 24, 2017

Hi,

In some cases (such as in Outlook 2016 ribbon), controls have access keys but not accelerator keys. If so, two spaces are appended. This should tno be done in order to not waste string real estte.

Note: the PR for it will be part of the PR for #6779. 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 #6779, #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 24, 2017

UIA keyboard shortcuts: insert two apces if and only if both access k…
…ey and accelerator are present, return longest string otherwise. re #6790.

A Python trick: when checking for logical and for two strings, it'll return a string (an empty string if one or both are truly empty). If logical and says 'false', then just return the longest string as the keyboard shortcut, otherwise insert two spaces.

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 #6779, #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 #6779, #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)
@jcsteh

This comment has been minimized.

Show comment
Hide comment
@jcsteh

jcsteh Apr 26, 2017

Contributor

PR #6792 got merged. Closing.

Contributor

jcsteh commented Apr 26, 2017

PR #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