Skip to content

Commit

Permalink
Treat tables with 1 col or 1 row as layout tables in Outlook message …
Browse files Browse the repository at this point in the history
…viewer (#12857)

Microsoft Outlook uses a Microsoft word document control to present emails when both reading and composing. NVDA is in the process of switching to using UI Automation to access Microsoft Word document controls due to major performance advantages, and also due to Microsoft no longer maintaining the Office object model.
However, in the UI automation implementation exposed by MS Word document controls, it is impossible to identify the difference between a data table and a layout table. Thus, NVDa reports all layout tables when reading, which is extremely annoying, as the majority of HTML emails use many nested layout tables.

Description of how this pull request fixes the issue:
Tables are now classed as layout tables in MS Word document controls if the app is Outlook, and the table is read-only (Outlook is in message reading view) and the table only has either 1 column or 1 row.
  • Loading branch information
michaelDCurran committed Sep 17, 2021
1 parent 44399c1 commit ec891bd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions source/NVDAObjects/UIA/wordDocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,19 @@ def _getControlFieldForUIAObject(self, obj, isEmbedded=False, startOfNode=False,
or field.pop('name', None)
or obj.name
)
# #11430: Read-only tables, such as in the Outlook message viewer
# should be treated as layout tables,
# if they have either 1 column or 1 row.
if (
obj.appModule.appName == 'outlook'
and obj.role == controlTypes.Role.TABLE
and controlTypes.State.READONLY in obj.states
and (
obj.rowCount <= 1
or obj.columnCount <= 1
)
):
field['table-layout'] = True
return field

def _getTextFromUIARange(self, textRange):
Expand Down
3 changes: 2 additions & 1 deletion user_docs/en/changes.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ If you need this functionality please assign a gesture to the appropriate script
- More dialog text is automatically read in LibreOffice Writer, such as in confirmation dialogs. (#11687)
- Reading / navigating with browse mode in Microsoft Word via UI automation now ensures the document is always scrolled so that the current browse mode position is visible, and that the caret position in focus mode correctly reflects the browse mode position. (#9611)
- When performing Say all in Microsoft Word via UI automation, the document is now automatically scrolled, and the caret position is correctly updated. (#9611)
-
- When reading emails in Outlook and NVDA is accessing the message with UI Automation, certain tables are now marked as layout tables, which means they will no longer be reported by default. (#11430)
-


== Changes for Developers ==
Expand Down

0 comments on commit ec891bd

Please sign in to comment.