Skip to content

Use UI automation for RICHEDIT60W in Microsoft Excel on Windows 10 and above#14839

Merged
michaelDCurran merged 6 commits into
masterfrom
richEdit60W
Apr 19, 2023
Merged

Use UI automation for RICHEDIT60W in Microsoft Excel on Windows 10 and above#14839
michaelDCurran merged 6 commits into
masterfrom
richEdit60W

Conversation

@michaelDCurran

@michaelDCurran michaelDCurran commented Apr 18, 2023

Copy link
Copy Markdown
Member

Link to issue number:

Found when investigating #5221
Fixes #6871
Fixes #11512
Though both of these issues had already been avoided in Outlook 2016+ by #14280

Summary of the issue:

When arrowing through a password in the password field in the Protect Sheet dialog in Microsoft Excel (alt h o p), NVDA produces an error and says nothing. Similarly, when tabbing to that control and the cursor is already on a password character, NVDA produces an error and the focus is not announced at all.

ERROR - scriptHandler.executeScript (18:54:08.558) - MainThread (5988):
error executing script: <bound method EditableText.script_caret_moveByCharacter of <NVDAObjects.Dynamic_IAccessibleRichEdit50WindowNVDAObject object at 0x0787CAF0>> with gesture 'home'
Traceback (most recent call last):
  File "scriptHandler.pyc", line 289, in executeScript
  File "editableText.pyc", line 229, in script_caret_moveByCharacter
  File "editableText.pyc", line 164, in _caretMovementScriptHelper
  File "NVDAObjects\behaviors.pyc", line 220, in _caretScriptPostMovedHelper
  File "editableText.pyc", line 150, in _caretScriptPostMovedHelper
  File "speech\speech.pyc", line 1231, in speakTextInfo
  File "speech\types.pyc", line 42, in __iter__
  File "speech\speech.pyc", line 1273, in getTextInfoSpeech
  File "NVDAObjects\window\edit.pyc", line 735, in getTextWithFields
  File "NVDAObjects\window\edit.pyc", line 677, in _getTextAtRange
  File "comtypes\__init__.pyc", line 278, in __getattr__
  File "monkeyPatches\comtypesMonkeyPatches.pyc", line 32, in __call__
_ctypes.COMError: (-2147467259, 'Unspecified error', (None, None, None, 0, None))

Description of user facing changes

NVDA no longer fails to announce the focus when tabbing to the password field in Excel's Protect sheet dialog.

Description of development approach

  1. In the ITextDocument TextInfo's text property: catch COMError when calling range.text. This can occur when the edit control is protected. Just log a debugWarning and return the empty string - there is nothing else we can do about this error. This allows NVDA to announce the focus without an error. And when arrowing through the characters, 'blank' will be spoken rather than an error, which is better than nothing.
  2. In the appModule for Excel: treat RICHEDIT60W windows as having a good UI automation implementation if on Windows 10 or higher and Office 2016 or higher. Office 2016 on Win 10+ has a very good UI automation implementation for RICHEDIT60W, which includes being able to fetch 'circle' characters when arrowing through a password.
    So in summary, on Office 2016 win10+ the error is gone and NvDA can announce 'circle' when arrowing through password characters in the Protect sheet dialog.
    On older versions of Office / Windows, the error is gone, though NVDA will announce 'blank' when arrowing through password characters.

Testing strategy:

Office 2016 on Windows 11:

  • Open a new workbook in Excel.
  • Press alt h o p to pen the Protect sheet dialog.
  • Type a password into the password field.
  • Arrow throuh the characters with left and right arrow, noticing that 'circle' is announced, and not an error.
  • Tab past the control and back to it again. Notice that the password field is announced, rather than staying silent and producing an error.

Known issues with pull request:

On older Office versions / older windows versions, 'blank' is announced when arrowing through the characters. Though previously nothing was announced an an error was produced.

Change log entries:

New features
Changes
Bug fixes
NVDA no longer fails to announce focusing the password field in Excel's Protect Sheet dialog.
For Developers

Code Review Checklist:

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

…t and return an empty string, logging a debugWarning. this can happen when the edit control is protected, such as in Excel's Protect sheet dialog.
@michaelDCurran michaelDCurran requested a review from a team as a code owner April 18, 2023 09:05
@michaelDCurran michaelDCurran requested a review from seanbudd April 18, 2023 09:05
@CyrilleB79

Copy link
Copy Markdown
Contributor

Any link or impact with #6871, #8380 and #11512?

Comment thread source/NVDAObjects/window/edit.py Outdated
@cary-rowen

Copy link
Copy Markdown
Contributor

It would be nice if this pr also fixes these issues mentioned by @CyrilleB79

@michaelDCurran michaelDCurran merged commit 03c31e5 into master Apr 19, 2023
@michaelDCurran michaelDCurran deleted the richEdit60W branch April 19, 2023 07:12
@nvaccessAuto nvaccessAuto added this to the 2023.2 milestone Apr 19, 2023
@CyrilleB79

This comment was marked as resolved.

@CyrilleB79

Copy link
Copy Markdown
Contributor

@michaelDCurran, sorry, ignore my previous comment.

I can see that you have closed the three issues (#6871, #8380 and #11512). Thanks for this confirmation!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Outlook password entry field error sounds and unexpected speech silence Problem reading the password field in outlook 2016

5 participants