Skip to content

Fixing table navigation commands by caching last column/row index#11923

Closed
mltony wants to merge 4 commits into
nvaccess:masterfrom
mltony:fixTableNavigationPreserveRowColumn
Closed

Fixing table navigation commands by caching last column/row index#11923
mltony wants to merge 4 commits into
nvaccess:masterfrom
mltony:fixTableNavigationPreserveRowColumn

Conversation

@mltony

@mltony mltony commented Dec 9, 2020

Copy link
Copy Markdown
Contributor

Link to issue number:

#11919, #7278

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 performed:

Performed test described in #11919.

Known issues with pull request:

None known at the moment.

Change log entry:

Fix table navigation commands to preserve column/row index in the presence of merged cells.
Section: Bug fixes

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit cb4469815e

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 64d22aa1a9

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 7196fee706

Comment thread source/documentBase.py Outdated
Comment thread source/documentBase.py Outdated
@CyrilleB79

Copy link
Copy Markdown
Contributor

Thanks @mltony for this quick PR! Let's hope it can be merged soon, this would really help me.

I have tested it and almost all is working well.
The tests on the web (Chrome) are OK.
I have even tested with 2 copies of the example page in #11919 opened in 2 different tabs. There is no interference between both table navigation, probably because these 2 pages correspond to 2 documents.
I have also tested with 2 times the same table on the same page with good results, probably thanks to selection comparison.

Navigation with simple arrow key do not cause column/row change in Excel, but Excel already behaves this way without screen reader.

Just the table nav in MS Word still cause column/row change when crossing a merged cell. I do not know how much it is linked to Word object model and if something can be done.

@CyrilleB79

Copy link
Copy Markdown
Contributor

Just the table nav in MS Word still cause column/row change when crossing a merged cell. I do not know how much it is linked to Word object model and if something can be done.

After looking a bit at the code, it seems that NVDA is responsible of row / column location, not Word object model.

@mltony do you plan to fix table navigation also in Word in this PR?
Thanks.

@CyrilleB79

Copy link
Copy Markdown
Contributor

@mltony would you mind to address the MS Word question if you have time? This would help to progress this PR.
Also let us know if you are not able to address it, e.g. because you do not have Word.
Thanks.

@mltony

mltony commented Jul 18, 2021

Copy link
Copy Markdown
Contributor Author

@CyrilleB79, I don't have bandwidth to work on MSWord issue - so if you have time feel free to take over.

@CyrilleB79

Copy link
Copy Markdown
Contributor

Thanks for the answer.
I am not sure to have time very soon for this one, but I keep it in mind if this changes in the future.

@seanbudd seanbudd self-requested a review July 22, 2021 04:02
@seanbudd seanbudd self-assigned this Jul 22, 2021
@codeofdusk

Copy link
Copy Markdown
Contributor

@seanbudd Any updates on this PR?

@seanbudd seanbudd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Apologies for the late review.

I am glad that caching this seems to be a viable fix.
Would it be possible to use caching decorators for a simpler solution? https://docs.python.org/3/library/functools.html#functools.lru_cache

Edit: perhaps functools.cached_property is more relevant

could a dataclass be used to make the cache more structured?
https://docs.python.org/3/library/dataclasses.html

Comment thread source/documentBase.py
Comment on lines +143 to +148
_lastTableSelection = None
_lastTableAxis = None
_lastTableRow = None
_lastTableRowSpan = None
_lastTableCol = None
_lastTableColSpan = None

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could this be turned into a dataclass?

@seanbudd

Copy link
Copy Markdown
Member

@codeofdusk are you interested in picking this up?

@surfer0627

Copy link
Copy Markdown
Contributor

@mltony

Excuse, how to download a try build for this PR?

Or could you consider to add this feature to an addon.

Thanks.

@seanbudd

Copy link
Copy Markdown
Member

I plan to fix up this PR slightly and open a new one for 2022.1

@seanbudd

Copy link
Copy Markdown
Member

Closing in favour of #13345

@seanbudd seanbudd closed this Feb 16, 2022
seanbudd added a commit that referenced this pull request Mar 25, 2022
…lumn/row index (#13345)

Follow up on the work done by @mltony in #11923

Fixes #7278, #11919

Summary of the issue:
When issuing table navigation commands repeatedly, 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants