Allow table navigation commands in Google Docs #7946
Conversation
…le2. Most useful for tables in Google Docs.
| try: | ||
| cell = table.IAccessibleTable2Object.cellAt(destRow - 1, destCol - 1).QueryInterface(IAccessibleHandler.IAccessible2) | ||
| except AttributeError: | ||
| cell = table.IAccessibleTableObject.accessibleAt(destRow - 1, destCol - 1).QueryInterface(IAccessibleHandler.IAccessible2) |
There was a problem hiding this comment.
is this guaranteed to succeed?
There was a problem hiding this comment.
It is guaranteed not to throw AttributeError. But it may throw COMError. The reason for catching AttributeError above is that IAccessibleTable2Object may not exist. However, at least one of IAccessibleTable2Object or IAccessibleTableObject will exist.
There was a problem hiding this comment.
Maybe it's assumed knowledge, but could you add a comment here to point that out?
| if cell.IA2Attributes.get('hidden'): | ||
| raise LookupError("Found hidden cell") | ||
| return self.makeTextInfo(cell) | ||
| except (COMError, RuntimeError): |
There was a problem hiding this comment.
Is there any way that you can narrow the scope of this try-except for COMError or RuntimeError. Its not apparent to me what will raise these?
There was a problem hiding this comment.
Any of the calls in the above try block could throw COMError. I think that makeTextInfo could throw RuntimeError... this was partly copied from virtualBuffers/gecko_ia2.py.
| cell = table.IAccessibleTableObject.accessibleAt(destRow - 1, destCol - 1).QueryInterface(IAccessibleHandler.IAccessible2) | ||
| cell = IAccessible(IAccessibleObject=cell, IAccessibleChildID=0) | ||
| if cell.IA2Attributes.get('hidden'): | ||
| raise LookupError("Found hidden cell") |
There was a problem hiding this comment.
How should this be handled? Is this left over debugging? If its not debugging, perhaps a comment to say what this might mean for those catching the exception.
|
An issue raised asking for table navigation in Google Docs: #7942 which suggests that one must swap to browse mode. This PR doesn't make it clear if table navigation is available in focus mode / browse mode / or both, could you mention that in the description? |
|
@feerrenrut: I put a note in the description. This is for focus mode. Browse mode should already work, though that is not the default way a user would interact with Google docs. Especially not when creating content. |
Link to issue number:
None
Summary of the issue:
Google Docs allows for tables in documents. Currently when arrowing around these documents with Google Docs braille mode enabled, NVDA announces these tables. However, it does not allow the user to perform NVDA table navigation commands (such as control+alt+arrows).
Description of how this pull request fixes the issue:
The IA2Web Editor NVDAObject now inherits also from documentBase.DocumentWithTableNavigation, and also implements _getTableCellAt. This allows table navigation to work for any editable content within an IAccessible2 web implementation (Firefox, Chrome etc).
Note that this is with focus mode which is the usual way a user would interact with Google Docs. Table navigation already works in browse mode.
Testing performed:
Created a document in Google Docs. Inserted a table. Arrows into the table, and then performed table navigation commands (up, down, left right).
Known issues with pull request:
None
Change log entry:
New features: