Improve shortcut key reporting#14900
Conversation
See test results for failed build of commit 7b192d8345 |
|
Hi @CyrilleB79 Can the fix of this PR cover the situation I described below: If this item does not have an artificial shortcut key specified using &, then NVDA will automatically guess that its shortcut key is the first letter "E" of the first word. Thanks |
In languages with Latin alphabet, or maybe also other alphabets, this default shortcuts may be useful. But I understand that in the case of languages using ideograms, this feature do not bring anything useful. Unfortunately, this PR does not bring anything new regarding the issue you describe. That's not NVDA guessing the shortcut with the first letter/character of the text; I think that it's Windows who provides this information via IAccessible interface. If you test with Narrator, you will have the same issue. You should thus report it to Microsoft. |
|
@CyrilleB79 |
See test results for failed build of commit f7535ccad9 |
michaelDCurran
left a comment
There was a problem hiding this comment.
In general this approach looks okay to me.
However, I found _splitShortcut a little confusing. If '+' (with or without whitespace is the only separator, You could pretty much get rid of the function, just split on '+', process each key with getKeySpeech (stripping any whitespace) and join it again with ' + '.
However, as for _splitSequentialShortcut: I found this very hard to follow. At very least could you provide a dostring explaining exactly what it does? Then perhaps I may have morefeedback on how that one could be improved.
|
@michaelDCurran, @seanbudd, I have added more documentation and slightly refactored the code for clarity. Also added a fix for corner case when the key "+" (plus) is used. I plan to add unit tests to capture all cases listed in the "Tests" section of the initial description. Let me know once you agree on all the functions signatures so that I can add it. @michaelDCurran youwrite:
No, this does not work when the name of a key contains the "+" character. E.g. "Touche de logo Windows + Plus (+)" (Zoom in button in Windows Magnifier, French version). This shortcut uses " + " as a separator ("plus" with spaces around) and uses "plus" between parenthesis in the key name.
I have added the docstring. I do not add any further comment here so that I can check if the code is clear enough or not. According to your feedback, I may add extra comments in the code if needed or change the algorithm (if you or I find another one). In this specific case, adding unit tests will probably not add more clarification since I have put an example in the docstring. |
| return seqOut | ||
|
|
||
|
|
||
| def _getKeyboardShortcutSpeech(keyboardShortcut: str) -> SpeechSequence: |
There was a problem hiding this comment.
it would be great if simple unit tests were added to these helper functions, just to document what they do.
seanbudd
left a comment
There was a problem hiding this comment.
Thanks @CyrilleB79, this LGTM
Hi sorry, just saw this note. I agree it's probably worth moving all the added functions to their own submodule, e.g. |
Public functions Moreover, in An alternative may be to pass the language as parameter, but in this case, I need to pass it as parameter in What do you think? If you expect also the public functions to be moved in |
Thanks, I think moving all new functions would be ideal. The goal is to move functions out of
You should be able to lazy import this in |
Done in 5ff17f7. While at it, I have also added one more unit test on
Yes. I have done this needing two lazy imports. IMO, using lazy imports show a suboptimal code organization. But since splitting |
This reverts commit e6612e9.
Fixes #15233 Summary of the issue: Unfortunately pr #14900 causes Code Factory Eloquence to spell out menu items with shortcut keys, such as in the NVDA menu. Description of user facing changes Menu items are no longer spelled out when focusing menu items when using the Code Factory Eloquence driver. Description of development approach Although the bug is technically in the Code Factory driver I think - not handlin character mode command correctly when embedded in other speech, PR 14900 is the first known case that exercises the bug directly. Because 2023.2 is not an add-on breaking release, we are reverting pr #14900. A replacement pr for 2023.3 can be opened that avoids affecting Code Factory Eloquence if at all possible, or a new copy of the reverted pr can be opened for NVDA 2024.1.
|
This PR has been reverted in #15237 Unfortunately this PR causes Code Factory Eloquence to spell out menu items with shortcut keys, such as in the NVDA menu. |
|
In anticipation of the reintroduction of this PR in NVDA 2024.1, the following code snippet executed in the console should allow Code Factory developers to test if their driver correctly supports @michaelDCurran have you had a contact with CodeFactory regarding this issue? Do they confirm that the bug is in their current driver? |
|
@seanbudd, @michaelDCurran |
|
Yep, opening a PR for this would be welcome. |
…ccess#15237)" This reverts commit e15fe8a.
…ccess#15237)" This reverts commit e15fe8a.
Fixes #10807 Reintroduce the changes of PR #14900 that were reverted in #15237. Summary of the issue: See #14900 for the initial issue. #14900 had to be reverted since it caused any speech sequence containing a character mode command to spell the whole speech sequence with Code Factory driver. Although the issue is in the driver and not NVDA, it has been decided to wait for an API-breaking release to issue this fix so that Code Factory synth users be not impacted by this bug. Description of user facing changes Same as #14900, that is: Shortcut key reporting will be improved in some cases. This applies to on-demand reporting (shift+numpad2) as well as when "Report Object Shortcut Keys" option is checked in Object presentation settings. The cases where it should be improved are: punctuation key, e.g. "." (dot) letter keys when the name of the letter is not spoken the same way as the equivalent one-letter word, e.g. "à" or "y" in French. Braille reporting should remain unchanged. Description of development approach Revert #15237 to reintroduce the changes in #14900 and remove change log modifications.
…5572) Closes #15566 Fix-up of #14900 / #15373. Summary of the issue: In #14900 / #15373., spelling mode was used (CharacterModeCommand) no matter the state of the "Use spelling functionality" option. The use spelling functionality exists because some old SAPI synth do not support spelling mode correctly. For them, this option needs to be honored. Description of user facing changes Use spelling functionality option will now be honored when reporting shortcuts. Description of development approach See logic in the code. If use spelling functionality option is disabled, the key is just reported as is.
Link to issue number:
Fixes #10807
Summary of the issue:
When reported by speech, some shortcut key or combination cannot be understood correctly in the following cases:
Description of user facing changes
Shortcut key reporting will be improved in some cases. This applies to on-demand reporting (shift+numpad2) as well as when "Report Object Shortcut Keys" option is checked in Object presentation settings.
The cases where it should be improved are:
Braille reporting should remain unchanged.
Description of development approach
CharacterModeCommandis passed to the synth so that the name of the letter is reported and not a possible one-letter word.Note: all the processing to split shortcut keys is in
speech/speech.pyas private functions. Reviewer: should they remain here or would they fit better elsewhere?Testing strategy:
Manual tests for the following shortcuts:
Tested the shortcut "Touche de logo Windows + Plus (+)" which is from Windows Magnifier. This shortcut has its shortcut keys separated with " + " (with space around the "plus" symbol) and uses the "+" symbol in a key label. It was tested as follows in the console:
Direct test on the magnifier cannot be done running from source since the Magnifier UI is not accessible when running from source (maybe UI Access is required for it?)
Tested also with various voices (Eloquence, OneCore, SAPI5 (Windows), eSpeak.
System tests have been updated to pass since the number of spaces in shortcut keys has changed. It is due to the use of
CharacterModeCommandin the speech sequence which adds some extra spaces when this sequence is converted to string.Known issues with pull request:
CharacterModeCommandis used.This PR does not fix this which is more a OneCore issue.
CharacterModeCommandin the speech sequence which converts to extra space when this sequence is converted to string for the speech viewer.Change log entries:
Bug fixes
Reporting of object shortcut keys has been improved. (#10807)Code Review Checklist: