Skip to content

Scrolling braille in MS Word with a Chinese input method enabled no longer incorrectly jumps back#12868

Merged
michaelDCurran merged 4 commits into
masterfrom
i12855
Sep 23, 2021
Merged

Scrolling braille in MS Word with a Chinese input method enabled no longer incorrectly jumps back#12868
michaelDCurran merged 4 commits into
masterfrom
i12855

Conversation

@michaelDCurran
Copy link
Copy Markdown
Member

Link to issue number:

Fixes #12855

Summary of the issue:

When in Microsoft Word, and using a Chinese input method such as Taiwan - Microsoft Quick, and NVDA is accessing Microsoft Word via UI Automation, trying to scroll forward through the document with a braille display causes the braille display to keep jumping back to the original caret position.
This is due to the fact that while the Chinese input method is enabled, legacy MSAA caret events are fired on the Word document window. NVDA is not ignoring these, even though NVDA is configured to access Microsoft word with UIA.

Description of how this pull request fixes the issue:

In IAccessibleHandler.processGenericWinEvent: if an MSAA caret event is identified, before we route this onto the focused object, we first check if the focused object is in deed IAccessible (MSAA), and if it is not (E.g. it is UIA) then we drop the event completely.
This pr also improves MSAA debug logging a little by including the winEvent info in the message about the caret being routed to the focus, and also routes generic events for the focus to the existing focus if their event object is not already the existing focus. This really only stops some extra redundant logging.

Testing strategy:

Opened the test document from #12855 in Microsoft word. Ensured that NVDA was accessing Microsoft Word with UIA (check defInfo in the log viewer).
Installed the Taiwan - Microsoft Quick input method in Windows language settings.
Switched to the Taiwan - Microsoft quick input method when focused in the word document, by pressing alt+shift 1 or more times until Taiwan - Microsoft Quick is selected.
Press scroll forward on the braille display multiple times, ensuring that the display is showing the correct line and is not jumping back to where the caret was originally positioned.
Also tested that MSAA caret events were still being routed to the focus in an MSAA-based window, such as the Scintilla control in Notepad++. Checked the log viewer with MsAA debug logging enabed to see that the caret events were being routed.
Ensured that generic MSAA events such as stateChange for the focused object are still being routed to the existing focus: Open the NvDA general settings, and tab to one of the checkboxes and press space, ensuring that NVDA reports "checked" if the checkbox was previously unchecked.

Known issues with pull request:

None known.

Change log entries:

Bug fixes

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

…ents to the currently focused object if the currently focused object is not an IAccessible (MSAA) object.

Fixes #12855 as the Chinese Microsoft Quick input method when used in Microsoft Word was firing MSAA caret events on the Word document, even though the Word document was UIA.
@michaelDCurran michaelDCurran requested a review from a team as a code owner September 22, 2021 09:23
@michaelDCurran
Copy link
Copy Markdown
Member Author

@cary-rowen
Copy link
Copy Markdown
Contributor

Hi Michael, I tested this build and confirmed that #12855 has been fixed.
I did not expect this to be caused by the Chinese input method. Thank you again for your outstanding contribution.
Thanks.

Comment thread source/IAccessibleHandler/__init__.py Outdated
Co-authored-by: Sean Budd <sean@nvaccess.org>
@michaelDCurran michaelDCurran merged commit 22dd011 into master Sep 23, 2021
@michaelDCurran michaelDCurran deleted the i12855 branch September 23, 2021 01:43
@nvaccessAuto nvaccessAuto added this to the 2021.3 milestone Sep 23, 2021
return
if NVDAEvent[1] == focus:
# if the winEvent is for the object with focus,
# Ensure that that the event is send to the existing focus instance,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Double that

michaelDCurran added a commit that referenced this pull request Nov 3, 2021
…ext. (#13020)

Fixes #12970
Fixes #13004
Fixes regression caused by pr #12868

Summary of the issue:
When accessing an MS Word document via UIA, the braille display is not updated when typing characters into the document, although it does correctly update if the caret is moved with the arrow keys and such.
Generally, NVDA tells braille to update for each caret event. However, In Microsoft Word, although the caret does technically move when typing characters, Microsoft Word only fires a UIA textchange event (NVDA textChange event), and not a caret event (UIA textSelectionChanged event).
Before pr #12868 , Braille did seem to update correctly, but that was because NvDA was incorrectly passing an MSAA caret event into the UIA NVDAObject with focus.

Description of how this pull request fixes the issue:
On the MS Word document NVDAObject, implement an event_textChange method which just instructs Braille to update.
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.

If UIA is enabled in Word, the "Scrolls the braille display back" and "Scrolls the braille display forward" will not work in focus mode

5 participants