Fix table navigation commands through merged cells by caching last column/row index#13345
Conversation
|
|
||
| def _getNearestTableCell( | ||
| self, | ||
| tableID, |
There was a problem hiding this comment.
What is the type of this?
There was a problem hiding this comment.
I'm not sure, it's not documented anywhere. I spent some time investigating and couldn't get a clear idea. As the change/type is unrelated and no information is lost, I'm hesitant to spend too long investigating this.
There was a problem hiding this comment.
I had a quick look. In virtual buffers it is an int, whereas in UIA it is a tuple (the runtime id). I guess it's safe to mark it any, as long as it can be compared.
| tableID, | |
| # At least known to be a tuple for UIA and an integer for virtual buffers | |
| tableID, typing.Any, |
There was a problem hiding this comment.
I added a type and summary to the module level, as tableID is used as a parameter elsewhere in the file, and will need to get type information added eventually.
This comment was marked as off-topic.
This comment was marked as off-topic.
|
Thanks @seanbudd to take over this PR. I have not tested the snapshot of the current PR. But I have some points to add here:
|
|
Thanks @CyrilleB79, that changelog entry reads fine for me, I've updated the PR description. I haven't tested with Word yet, however this PR uses the same approach as in #11923, so if the issue was present in Word with #11923, this is still the case. |
|
@CyrilleB79 - It appears that the behaviour is fixed with MS Word as well now. This did need the latest master merged in to work with MS word, I think due to a related fix for table navigation in MS word. |
|
@seanbudd, no it is not completely fixed for MS Word; it behaves the same way as NVDA 2021.3.1. More generally, I think that the table nav experience should be consistent between all the applications.
I have tested navigating the whole table horizontally, then vertically in either direction. Table navigation is as expected in the html file (with Chrome). For Word document I get the following issues:
For PDF document, I get the following issue:
It makes a lot of issues, but many of them are probably related to each other. |
|
@seanbudd, first of all thanks for taking over this PR!
|
…reserveRowColumn-2
This will only fix the problem if UIA is enabled. I'm not sure of way to compare the selection ( |
|
To fix the UIA case, UIABrowseModeDocumentTextInfo should inherit (at least eq and hash) from UIATextInfo. |
…reserveRowColumn-2 # Conflicts: # tests/system/robot/chromeTests.py # tests/system/robot/chromeTests.robot
|
I've reopened this PR, so that the remaining bug can be fixed in a separate PR eg #13396 |
This comment was marked as off-topic.
This comment was marked as off-topic.
… class UIABrowseModeDocumentTextInfo comparable (#13396) PR #13345 fixes navigating over merged cells in tables by caching the last column/row. Testing showed that it doesn't work in MS Word while in browse mode (focus mode works fine). This was tracked down to class UIABrowseModeDocumentTextInfo not implementing eq method. Description of how this pull request fixes the issue: Fixing that by implementing eq and hash functions in parent class RootProxyTextInfo.
|
|
||
|
|
||
| _TableID = Union[int, Tuple, Any] | ||
| """ |
There was a problem hiding this comment.
I have never seen this pattern of an unnamed string following an assignment statement. Is it supposed to become the symbol's docstring? I'm not sure that actually works?
There was a problem hiding this comment.
epydoc supports this, however I have discovered it is bad practice, and part of the rejected PEP 224.
It appears the correct pattern for this in future is typing.Annotated in python 3.9.
There was a problem hiding this comment.
We have been using this pattern already in some contexts such as BACK_COMPAT_TO, appModuleHandler.helperLocalBindingHandle.
Intermittent GC error "unreachable objects" caused by PR #13345. Description of how this pull request fixes the issue: The root cause was that we used to store TextInfo object inside Document, thus creating a cyclic reference. Such reference loops cannot be deleted by zeroing reference counter and can only be deleted by full GC sweep. I am not sure why NVDA prints warnings in this case. This was fixed by not storing TextInfo in the first place. We now store last cell coordinates as lastRow/lastCol. Table cache is going to be valid as long as row/col of current selection are the same as stored lastRow/lastCol - and in this case we will be using trueRow/trueCol to compute next cell to preserve coordinates when navigating through merged cells.
Follow up on the work done by @mltony in #11923
The approach is the same, just that types are added and a dataclass is used to cache the selection.
Link to issue number:
Fixes #7278, #11919
Summary of the issue:
When issuing table navigation commands repeadetly, e.g. pressing Control+Alt+Down several times in a row, the original column index is currently not preserved. Thus, if there happens to be a merged cell on the way, the column index will be reset to the minimal column index of merged cell.
Description of how this pull request fixes the issue:
This PR caches original column index for vertical table navigation and original row index for horizontal table navigation.
Testing strategy:
Known issues with pull request
Change log entries:
Bug fixes
Code Review Checklist: