Skip to content

Speech feedback on more Word formatting shortcuts#17197

Merged
seanbudd merged 13 commits into
nvaccess:masterfrom
CyrilleB79:vocalizeWordFormattingShortcuts2
Sep 26, 2024
Merged

Speech feedback on more Word formatting shortcuts#17197
seanbudd merged 13 commits into
nvaccess:masterfrom
CyrilleB79:vocalizeWordFormattingShortcuts2

Conversation

@CyrilleB79

@CyrilleB79 CyrilleB79 commented Sep 20, 2024

Copy link
Copy Markdown
Contributor

Link to issue number:

Fixes (at least partially) #10271

Supersedes #10283.

Summary of the issue:

User wants to have font formatting state announced when native font formatting shortcut are executed under Word and Outlook.

Description of user facing changes

The results of the following MS Word shortcuts are now reported:

  • control+shift+D: Underline double
  • control+shift+W: Underline words only
  • control+shift+A: All caps
  • ctrl+Shift+K: Small caps
  • ctrl+shift+i, ctrl+shift+b and ctrl+shift+u: alternative gestures for toggle italic, bold and underline.

When relevant, these shortcuts are also reported in Outlook.

Notes about various capitalization shortcuts

  • In Word, the Shift+F3 and Ctrl+Shift+A shortcuts are slightly different:

    • Shift+F3 only modifies the case of the current selection (or the word under the cursor if there is no selection)
    • Ctrl+Shift+A also modifies the case of selected text (or current word), but in addition, it modifies the case of the characters that will be typed at insertion point of the cursor.
  • Outlook's Ctrl+Shift+A shortcut is equivalent to Word's Shift+F3, whereas Word's Ctrl+Shift+A has no equivalent under Outlook as far as I know.

Messages

Word's shortcuts Ctrl+Shift+A, Ctrl+Shift+K and Shift+F3 modify all the selection's (or current word's) capitalization. However, Ctrl+Shift+A and Ctrl+Shift+K also impact the next characters that will be typed. Thus for this shortcut "on" and "off" have been used in their announced message in order to denote a state change. On the contrary Shift+F3 announces only the result of a modification of current selection (or word); thus "on" and "off" have not been used in its message.

Description of development approach

Use object model and polling to check state change, as done for other formatting scripts.

Testing strategy:

Tested all combinations:

  • In Word and in Outlook message (edition), English version
  • For all previously listed shortcuts

Known issues with pull request:

  • This PR intially also aimed to support speech feedback for change case command, i.e. shift+f3 (in both Word and Outlook) and control+shift+A in Outlook only. However, the object model property looked at for this sometimes transition through an intermediate state. Thus, this command is finally not supported by this PR, i.e. nothing is reported, rather than taking the risk to report something erroneous from time to time.
  • Translators will have to modify the gestures.ini files in SRT repo (or elsewhere if the process changes) according to native Word or Outlook shortcuts in their language if these differ from English. I plan to inform them in detail when the beta translation freeze occurs. Or to open a separate dedicated PR if it is the new process.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@coderabbitai summary

@CyrilleB79

Copy link
Copy Markdown
Contributor Author

For the much more common underline shortcut control+u, we end up with "underline single" being reported instead of "underline on" before this PR. I was not very convinced to change this but Reef had recommended it at the time (#10283 (comment)). What is your opinion?

@CyrilleB79 CyrilleB79 force-pushed the vocalizeWordFormattingShortcuts2 branch from caa7e90 to 48c7e8c Compare September 22, 2024 17:30
@seanbudd

Copy link
Copy Markdown
Member

@CyrilleB79 - I think to be consistent we need to solve 2 problems:

  • whether to report "on" at the end in all cases. I don't think it should only happen for the single case. Right now this PR proposed to replace "on" with the style of underline. I think it would be fine to add "on" at the end after for all cases. It would be more consistent with the overall NVDA UX, but perhaps unnecessarily verbose.
  • whether to be verbose reporting "single" for single underlines. I think fully dropping "single" would be fine (i.e. making the style string empty), however in that case we should probably make "on" be reported in all cases.

My preference would be:

  • reporting "on" in all cases
  • having an empty string for the style of single underlines

But I would accept the current alternative of:

  • no longer reporting "on"
  • reporting "single" for single underlines

@seanbudd seanbudd added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Sep 24, 2024
@CyrilleB79

Copy link
Copy Markdown
Contributor Author

@seanbudd, I have done the following change and updated the initial description:

  1. Remove the change case command (shift+f3) since the object model does not report a stabilized value, thus the reported value may not be reliable, neither in Outlook, nor in Word. It's worth noting that shift+f3 was not requested initially in precise Announcing of the state of formatting settings when a hotkey in word is pressed #10271.
  2. Reverted the new shortcuts for subscript and superscript since the situation is more complex (shortcut changed between 2016 and 365). I'd prefer handle this in a separate issue in order not to delay this PR as the previous one was!
  3. Mapped control+shift+b only in Word since in Outlook, it's the address book shortcut.

I'll pass this PR to ready state as soon as the build and tests are successful.

@CyrilleB79 CyrilleB79 marked this pull request as ready for review September 24, 2024 15:37
@CyrilleB79 CyrilleB79 requested a review from a team as a code owner September 24, 2024 15:37
@CyrilleB79 CyrilleB79 requested a review from seanbudd September 24, 2024 15:37

@seanbudd seanbudd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good to me

Comment thread source/NVDAObjects/window/winword.py Outdated
Comment thread source/NVDAObjects/window/winword.py Outdated
Comment thread source/NVDAObjects/window/winword.py Outdated
CyrilleB79 and others added 2 commits September 25, 2024 07:28
Co-authored-by: Sean Budd <seanbudd123@gmail.com>
@CyrilleB79

Copy link
Copy Markdown
Contributor Author

@seanbudd thanks for your review. The changes have been applied.

seanbudd pushed a commit that referenced this pull request Nov 26, 2024
Fixes #10271 (last part)
Also could be considered a partial fix of #3293.

Summary of the issue:
In Word / Outlook, nothing is reported when using the switch case command (shift+f3 in both, control+shift+a in Outlook only). Since it is a toggle/cycle command, the user needs to have the result to be reported.

Description of user facing changes
Using the switch case formatting command in Word or Outlook now reports its result, i.e. the type of case in which the selection has been formatted.

When possible, the message being reported illustrates its own casing, as in Word menus, e.g. "lower case", "UPPERCASE", "Each Word Capitalized"; this may be useful in braille. Exception, for "Mixed case", I have not done something such as "mIxEd cAsE" because it is not correctly understandable through speech.

Description of development approach
Used Word object model as for other Word formatting scripts.
Introduced a delay (set empirically), since the property retrieved from the object model transitions through other values (no case or lower case) before reaching its definitive value.
Bind gestures according to the ones existing in Word and Outlook.
Note: shift+f3 performs case switch both in Word and Outlook, whereas control+shift+A does it only in Outlook. See "Notes about various capitalization shortcuts" in #17197 for more details.
CyrilleB79 pushed a commit to CyrilleB79/nvda that referenced this pull request Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants