Repository: nvaccess/nvda

Issue:
Cannot move to first column in some tables in Firefox with NVDA 2022.4
<!-- Please read the text in this edit field before filling it in.
Please thoroughly read NVDA's wiki article on how to fill in this template, including how to provide the required files.
Issues may be closed if the required information is not present.
https://github.com/nvaccess/nvda/blob/master/devDocs/githubIssueTemplateExplanationAndExamples.md
Please also note that the NVDA project has a Citizen and Contributor Code of Conduct which can be found at https://github.com/nvaccess/nvda/blob/master/CODE_OF_CONDUCT.md. NV Access expects that all contributors and other community members read and abide by the rules set out in this document while participating or contributing to this project. This includes creating or commenting on issues and pull requests. 

Each of the questions and sections below start with multiple hash symbols (#). Place your answers and information on the blank line below each question.
-->

### Steps to reproduce:

1. Load https://en.wikipedia.org/wiki/List_of_largest_cities 
2. Move to the second table (with 84 rows and 14 columns containing the list of largest cities)
3. Use table navigation commands to move around the table:
 - control+alt+arrows to move by one column
 - control+alt+page up / down to move to top or bottom row
 - control+alt+home to move to first column
 - control+alt+end to move to end column
 4. Try the same on a table in the NVDA user guide
 
### Actual behavior:
<!--
Use "Speak command keys" (NVDA+4) and speech viewer to copy and paste here. 
Use braille viewer to copy and paste here.
You may additionally include an explanation.
-->

Everything works fine when testing with Chrome, and everything works fine testing with NVDA 2022.3.2.

Everything works as expected in the user guide, and everything works in the wikipedia table except the move to first column command, control+alt+home.

This command generates the following in the log:

> IO - inputCore.InputManager.executeGesture (09:22:34.837) - winInputHook (21668):
> Input: kb(desktop):alt+control+home
> ERROR - scriptHandler.executeScript (09:22:34.872) - MainThread (2800):
> error executing script: <bound method DocumentWithTableNavigation.script_firstColumn of <virtualBuffers.gecko_ia2.Gecko_ia2 object at 0x00BF9E70>> with gesture 'alt+ctrl+home'
> Traceback (most recent call last):
>   File "virtualBuffers\gecko_ia2.pyc", line 540, in _getTableCellAt
>   File "comtypes\__init__.pyc", line 856, in __call__
>   File "monkeyPatches\comtypesMonkeyPatches.pyc", line 32, in __call__
> _ctypes.COMError: (-2147024809, 'The parameter is incorrect.', (None, None, None, 0, None))
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
>   File "documentBase.pyc", line 321, in _getFirstOrLastTableCell
>   File "virtualBuffers\gecko_ia2.pyc", line 548, in _getTableCellAt
> LookupError
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
>   File "scriptHandler.pyc", line 289, in executeScript
>   File "documentBase.pyc", line 500, in script_firstColumn
>   File "documentBase.pyc", line 417, in _tableMovementScriptHelper
>   File "documentBase.pyc", line 369, in _tableFindNewCell
>   File "documentBase.pyc", line 327, in _getFirstOrLastTableCell
> AttributeError: '_TableCell' object has no attribute 'TableID'


### Expected behavior:
<!--
Use "Speak command keys" (NVDA+4) and speech viewer to copy and paste here. 
Use braille viewer to copy and paste here.
You may additionally include an explanation.
-->

### NVDA logs, crash dumps and other attachments:

### System configuration
#### NVDA installed/portable/running from source:

#### NVDA version:

NVDA 2022.4 installed exhibits this error.

#### Windows version:

Windows 11 (64-bit) Version: 22H2, Build: 22621.1105 

#### Name and version of other software in use when reproducing the issue:

Firefox version: 108.0.2 

Chrome Version: 108.0.5359.126 
#### Other information about your system:

### Other questions
#### Does the issue still occur after restarting your computer?

Yes

#### Have you tried any other versions of NVDA? If so, please report their behaviors.

NVDA 2022.3.2 works correctly with all table commands.

#### If NVDA add-ons are disabled, is your problem still occurring?

Yes - no add-ons installed.

#### Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?

Yes.  Also reported by users in the NVDA user group:  https://nvda.groups.io/g/nvda/message/102618



Discussion:
Hi, I suspect this might be something going on with that specific table – hope to be proven wrong with another example from a different website exhibiting this issue. Thanks.


CC @JCSTeh if you don’t mind.



Resolving patch:
diff --git a/source/documentBase.py b/source/documentBase.py
--- a/source/documentBase.py
+++ b/source/documentBase.py
@@ -324,7 +324,7 @@ def _getFirstOrLastTableCell(
 			return self._getNearestTableCell(
 				startPos,
 				_TableCell(
-					cell.TableID,
+					cell.tableID,
 					destRow,
 					destCol,
 					rowSpan=1,


Test patch: