Skip to content

Word 365: do not announce font attribute toggle messages if raised from UIA notification event#10990

Merged
seanbudd merged 11 commits into
nvaccess:masterfrom
josephsl:i10950
Sep 2, 2024
Merged

Word 365: do not announce font attribute toggle messages if raised from UIA notification event#10990
seanbudd merged 11 commits into
nvaccess:masterfrom
josephsl:i10950

Conversation

@josephsl

@josephsl josephsl commented Apr 13, 2020

Copy link
Copy Markdown
Contributor

Link to issue number:

Fixes #10950

Summary of the issue:

In recent Word 365 releases, NVDA will announce font attribute toggle message up to two times - a message defined by NVDA ,and a second time thanks to UIA notification event.

Description of how this pull request fixes the issue:

Builds on an earlier work on Word 365 UIA notification event suppression (#10851):

  • Adds a dedicated list in UIA.WordDocument class listing activity ID's NVDA should ignore.
  • Adds AccSN1, the activity Id for font attribute toggle messages.

Testing performed:

Tested to make sure font attribute toggle messages are announced only once with Word 365, and verified that there was no regression with previous work on Word 365 fix.

Known issues with pull request:

None

Change log entry:

Nothing to add, but if a what's new entry should be provided, a wording similar to #10851 is ideal, this time talking about font attribute toggle commands such as toggling bold.

Thanks.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of Word 365 notifications to prevent unnecessary announcements for specific edit functions, enhancing the user experience by reducing noise.

…tions that should be silenced under a dedicated list. Re nvaccess#10950.

To prepare for cases where additional UIA notification activity Id's must be silenced, collect them under a dedicated list. In addition to AccSN2 (delete back word), add AccSN1 (font attributes toggle).
…eed if activity ID's are listed under no activity ID's list. Re nvaccess#10950.
Comment thread source/NVDAObjects/UIA/wordDocument.py Outdated
…ss#10950.

Comment from Reef Turner (NV Access): rename noNotificationActivityIds to suppressedActivityIds which makes more sense and is more concise.
@michaelDCurran

Copy link
Copy Markdown
Member

These notifications are needed in Windows 10 Mail and other future scenarios where the Office object model is unavailable. We should somehow still allow the notifications in these situations.
The WinwordSelectionObject property on the NVDAObject for the document will be None in these scenarios.

@josephsl

josephsl commented Apr 15, 2020 via email

Copy link
Copy Markdown
Contributor Author

@josephsl

josephsl commented Apr 16, 2020

Copy link
Copy Markdown
Contributor Author

Hi,

Regarding Windows 10 Mail, when trying to change font attributes, NVDA does not announce changes - no UIA notification event at all, I'm afraid. Things cna change though.

Thanks.

@feerrenrut

Copy link
Copy Markdown
Contributor

Could this problem (differences in desired UIA notifications between mail and word) be addressed by fetching the list of ignored UIA notifications from the appmodule?

@josephsl

Copy link
Copy Markdown
Contributor Author

Hi,

Possibly yes, but there are cases where it might not be the case:

  • UIA objects may span across apps: different apps may use the same UIA object, especially if it is provided by XAML and other frameworks. If these elements raise UIA notification event, locating apps where this happens might become a challenge.
  • Other ways to determine notification announcements: Word 365 comes with WinwordSelectionObject and does raise UIA notification event, whereas Windows 10 Mail does not come with this object nor fires notification events.

In the short term, it will be possible to let app modules tell NVDA whether or not UIA notification event should be passed onto UIA objects (app modules handle events before NVDA objects do). If it is implemented (I'm willing to do so once new feature PR freeze ends), it will lay the foundation to resolve Windows 10 Calculator bug (even then, Calculator app module must inform NVDA as to when to suppress UIA notification events). In the long term, app vendors should be reminded that UIA notification events are meant for essential information - Edge and Alarms and Clock apps are examples of good use of notification event.

Thanks for bringing this up.

@josephsl

josephsl commented Apr 5, 2021

Copy link
Copy Markdown
Contributor Author

Hi,

2021 update: upon further testing, it appears a different approach is needed - a UIA notification event handler for Word app module, made more easier as there is already a proof of concept with a different app module (see Windows 10 App Essentials add-on). I'll rework this PR and perhaps target this for 2021.2 or later.

Thanks.

@josephsl

josephsl commented Apr 5, 2021

Copy link
Copy Markdown
Contributor Author

Hi,

By the way, the rework plan also calls for transferring UIA notification event handler from Word document UIA object to Word app module unless UIA notification event is raised when changing fonts in other Office 365 applications.

Thanks.

@feerrenrut

Copy link
Copy Markdown
Contributor

I'm going to mark this as a draft while work is on going.

@feerrenrut feerrenrut marked this pull request as draft April 7, 2021 06:02
@josephsl

josephsl commented Apr 7, 2021 via email

Copy link
Copy Markdown
Contributor Author

@josephsl

Copy link
Copy Markdown
Contributor Author

Hi,
Although I couldn't generate a debug log, it turns out UIA notification event can be seen in Outlook, therefore it justifies WordDocument object scope for dealing with UIA notification event.

Reopening the PR for review (targeting 2021.2).

@josephsl josephsl marked this pull request as ready for review May 10, 2021 15:08
@josephsl josephsl requested a review from a team as a code owner May 10, 2021 15:08
@josephsl josephsl requested a review from seanbudd May 10, 2021 15:08
@seanbudd

Copy link
Copy Markdown
Member

These notifications are needed in Windows 10 Mail and other future scenarios where the Office object model is unavailable. We should somehow still allow the notifications in these situations.
The WinwordSelectionObject property on the NVDAObject for the document will be None in these scenarios.

I'm hesitant to review this as I'm not confident this comment has been addressed. Is Windows 10 mail (and other scenarios Mick mentioned here that could arise) reporting this properly? Could we add system tests for Windows 10 mail?

@josephsl

josephsl commented May 21, 2021 via email

Copy link
Copy Markdown
Contributor Author

@seanbudd seanbudd requested a review from michaelDCurran June 7, 2021 02:01
@seanbudd

seanbudd commented Jun 7, 2021

Copy link
Copy Markdown
Member

@michaelDCurran - requesting your review here as per your previous comment, as we are unsure what the future impacts of merging this fix would be.

These notifications are needed in Windows 10 Mail and other future scenarios where the Office object model is unavailable. We should somehow still allow the notifications in these situations.
The WinwordSelectionObject property on the NVDAObject for the document will be None in these scenarios.

I'm hesitant to review this as I'm not confident this comment has been addressed. Is Windows 10 mail (and other scenarios Mick mentioned here that could arise) reporting this properly?

@josephsl

josephsl commented Jun 7, 2021 via email

Copy link
Copy Markdown
Contributor Author

@josephsl

josephsl commented May 29, 2024 via email

Copy link
Copy Markdown
Contributor Author

@seanbudd

Copy link
Copy Markdown
Member

I think this PR needs wider testing then. Can anyone test these scenarios and report back?

@coderabbitai can you summarise the discussion on this PR?

@coderabbitai

coderabbitai Bot commented May 30, 2024

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@seanbudd, here's a summary of the discussion on this PR:

Overview

The PR aims to address the issue of duplicate announcements of font attribute toggles in Word 365 by suppressing certain UIA notifications. This builds on previous work to manage UIA notifications more effectively in NVDA.

Key Discussion Points

  1. UIA Notifications in Word:

    • The PR initially focuses on preventing double announcements in Word by ignoring specific UIA notifications identified by their activity IDs.
    • Concerns were raised about how these changes might affect other applications like Windows 10 Mail, especially in scenarios where the Office object model is unavailable.
  2. Compatibility Across Office Versions:

    • Participants discussed the behavior of UIA notifications in different versions of Office, noting that only certain commands (like Ctrl+B/I/U) trigger UIA notifications in newer versions.
    • There were reports of inconsistent behavior depending on the cursor's position and the state of formatting commands, which led to discussions about the reliability of UIA notifications.
  3. Impact on Other Applications:

    • The discussion highlighted the need for a flexible approach that could adapt to different applications and environments. The idea of fetching ignored UIA notifications from the app module was proposed but noted to have potential limitations due to shared UIA objects across applications.
  4. Proposed Solutions and Technical Challenges:

    • Suggestions included moving the UIA notification handler from the Word document UIA object to the Word app module and creating configurable options for managing UIA notifications.
    • The technical feasibility and long-term maintenance of these solutions were debated, with insights into the complexity of implementing such changes.
  5. Testing and Future Considerations:

    • The need for extensive testing was emphasized, particularly in environments like Microsoft Defender Application Guard (MDAG) and across different Office versions.
    • Future updates from Microsoft and the evolution of Office applications like Project Monarch were mentioned as factors that could influence the handling of UIA notifications.

Conclusion

The discussion reflects a complex interplay of technical challenges, application behaviors, and user experience considerations. The community is leaning towards a cautious approach, favoring thorough testing and configurable solutions to accommodate the diverse needs of NVDA users across different Microsoft Office environments.

Please let me know if there are specific aspects of the discussion you would like to delve deeper into or if further clarification is needed on any points.

@Adriani90

Copy link
Copy Markdown
Collaborator

I cannot reproduce these mistranslated examples reported in #10950 with NVDA last alpha and Microsoft 365 MSO (Version 2405 Build 16.0.17628.20006) 64 Bit in german or romanian language.
But those messages are probably properly translated by Microsoft in these languages. It seems only spanish was impacted in that issue.

@ivnc, @nvdaes could you test whether the issue with double reportings is still occuring for you in the wrong translation?
If the translation is now correct, I think this PR is not really needed anymore.
The message provided by NVDA is interupted by the UIA notification, but it is really hard to distinduish that there are two messages spoken actually unless you look into the log file.
I think instead of dropping the whole UIA notifications, it might be better to contact Microsoft and suggest to them to translate the UIA messages in your Office language properly.

@nvdaes

nvdaes commented May 31, 2024

Copy link
Copy Markdown
Collaborator

Now I can listen right translated messages, but I distinguish that the start of the message is briefly interrupted, repeating the first character. I've tested control+n (bold/negrita), control+s (underline/subrayado), and control+k (italic/cursiva), in Word 365, Windows 11.

@Adriani90

Adriani90 commented May 31, 2024 via email

Copy link
Copy Markdown
Collaborator

@josephsl

josephsl commented May 31, 2024 via email

Copy link
Copy Markdown
Contributor Author

@Adriani90

Adriani90 commented May 31, 2024 via email

Copy link
Copy Markdown
Collaborator

@CyrilleB79

Copy link
Copy Markdown
Contributor

@Adriani90 the situation is more complex. The decision to use object model or UIA notifications should be base on various parameters: Office version (2013 / 2016 / 365, etc.), Office build version, software used (Word or Outlook), Windows version (8.1 or 10/11) and running in MDAG or not.

You need to read all the comments for more context; be careful: given the high number of comments, some of them are hidden so you'll have to display them.

@Adriani90

Adriani90 commented May 31, 2024 via email

Copy link
Copy Markdown
Collaborator

@CyrilleB79

Copy link
Copy Markdown
Contributor

In my case I tested with objectModel and still the UIA notifications are translated properly. MDAG I will test as well soon, but you can be sure that in 365 the UIA notifications are fired properly with objectModel and also when UIA is enabled. You can test yourself.In Office 2016, the NVDA messages should definitely remain.

@Adriani90 to be clear and avoid any confusion, UIA vs object model notifications upon formatting command are by no mean controlled by the option "Use UI Automation to access Microsoft Word document controls" in advanced settings.

@josephsl josephsl requested a review from a team as a code owner June 27, 2024 23:01
@josephsl josephsl requested a review from Qchristensen June 27, 2024 23:01
@coderabbitai

coderabbitai Bot commented Jun 27, 2024

Copy link
Copy Markdown
Contributor

Walkthrough

The recent update to the WordDocument class in wordDocument.py introduces a check within the event_UIA_notification method. This check prevents NVDA from announcing specific Microsoft Word edit functions by verifying if the activityId is among the predefined suppressedActivityIds. These modifications address redundant notifications for font attribute changes observed in the latest Word 365 releases.

Changes

File Change Summary
source/NVDAObjects/UIA/wordDocument.py Updated event_UIA_notification method logic to include a check for activityId in suppressedActivityIds to suppress announcements for specific edit functions. Added the suppressedActivityIds list to the WordDocument class.

Sequence Diagram(s)

The changes provided are mainly refinements to existing functionality, focusing on filtering out specific notifications. Therefore, a sequence diagram is not necessary for this explanation.

Assessment against linked issues

Objective Addressed Explanation
Prevent NVDA from announcing duplicate notifications for font attribute changes in Word 365 (#10950)
Ensure the notifications are suppressed for specific recent Word 365 releases' edits (#10950)

Recent review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 23cb96b and 8f73f22.

Files selected for processing (1)
  • source/NVDAObjects/UIA/wordDocument.py (1 hunks)
Additional context used
Path-based instructions (1)
source/NVDAObjects/UIA/wordDocument.py (2)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious.


Pattern **/*.py: _, pgettext, ngettext, and ngettext are defined globally, errors for this being undefined can be ignored.

Additional comments not posted (1)
source/NVDAObjects/UIA/wordDocument.py (1)

565-568: Clarify the purpose of suppressedActivityIds entries.

The list suppressedActivityIds is correctly initialized with activity IDs that should be suppressed. However, the comments could be more descriptive to explain why these IDs are chosen without needing to refer to the issue tracker.

-		"AccSN1",  # #10950: font attributes
+		"AccSN1",  # Suppress duplicate announcements for font attribute changes
-		"AccSN2",  # #10851: delete activity ID
+		"AccSN2",  # Suppress duplicate announcements for delete actions

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Comment thread source/NVDAObjects/UIA/wordDocument.py
@seanbudd seanbudd added merge-early Merge Early in a developer cycle and removed blocked labels Sep 2, 2024
@seanbudd

seanbudd commented Sep 2, 2024

Copy link
Copy Markdown
Member

We're considering trialling this PR for wider testing by merging early in an alpha cycle. Any thoughts @josephsl ?

@josephsl

josephsl commented Sep 2, 2024 via email

Copy link
Copy Markdown
Contributor Author

@seanbudd seanbudd closed this Sep 2, 2024
@seanbudd seanbudd reopened this Sep 2, 2024
@seanbudd seanbudd merged commit ec3d033 into nvaccess:master Sep 2, 2024
@github-actions github-actions Bot added this to the 2025.1 milestone Sep 2, 2024
@josephsl josephsl deleted the i10950 branch November 4, 2024 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app/microsoft-office blocked/needs-testing bug/double-speaking bug conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. merge-early Merge Early in a developer cycle

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Word 2019 last version duplicates NVDA attribute change notification when formatting text through keystrokes