Skip to content

Browse mode: When the user moves the cursor, speak before setting selection.#10389

Merged
michaelDCurran merged 1 commit into
nvaccess:masterfrom
jcsteh:browseSpeakBeforeMove
Oct 21, 2019
Merged

Browse mode: When the user moves the cursor, speak before setting selection.#10389
michaelDCurran merged 1 commit into
nvaccess:masterfrom
jcsteh:browseSpeakBeforeMove

Conversation

@jcsteh

@jcsteh jcsteh commented Oct 16, 2019

Copy link
Copy Markdown
Contributor

Link to issue number:

Fixes #8831. Fixes #10343.

Summary of the issue:

In browse mode, if you move the cursor to something focusable and focusing it causes content earlier in the document to be removed, NVDA reports the wrong part of the document. See the issues linked above for test cases.

Description of how this pull request fixes the issue:

Currently, for both normal cursor movement and quick navigation, we set the selection before speaking. However, setting selection might move the focus, which might mutate the document. For virtual buffers, the TextInfo is offset-based, so this could invalidate the offsets, causing the wrong part of the document to be spoken. To get around this, this change speaks before setting the selection instead of after.

Testing performed:

Verified with the test cases in the issues linked above.

Known issues with pull request:

If the newly focused element mutates its own content when focused, we won't speak the mutated content, since we speak before focusing. However, I think that's far less egregious than the problem we're fixing here and less likely to be a "real" problem.

We could fix this for quick nav by somehow re-fetching the TextInfo from the QuickNavItem between the moveTo and report calls. However, I don't think this can be done for normal cursor movement, since normal cursor movement isn't bounded by a single object. I don't think we want to be inconsistent here.

Change log entry:

Bug fixes:
- In browse mode, if moving the cursor or using quick navigation causes the document to change, NVDA no longer speaks incorrect content in some cases. (#8831, #10343)

…ection.

Previously, for both normal cursor movement and quick navigation, we set the selection before speaking.
However, setting selection might move the focus, which might mutate the document.
For virtual buffers, the TextInfo is offset-based, so this could invalidate the offsets, causing the wrong part of the document to be spoken.
To get around this, we now speak before setting the selection.
@jcsteh jcsteh requested a review from michaelDCurran October 16, 2019 04:29
@Brian1Gaff

Brian1Gaff commented Oct 16, 2019 via email

Copy link
Copy Markdown

@michaelDCurran michaelDCurran merged commit 74f5397 into nvaccess:master Oct 21, 2019
@nvaccessAuto nvaccessAuto added this to the 2019.3 milestone Oct 21, 2019
michaelDCurran added a commit that referenced this pull request Oct 21, 2019
@jcsteh jcsteh deleted the browseSpeakBeforeMove branch October 22, 2019 00:39
JulienCochuyt added a commit to accessolutions/nvda that referenced this pull request Nov 4, 2019
michaelDCurran pushed a commit that referenced this pull request Nov 10, 2019
michaelDCurran added a commit that referenced this pull request Mar 10, 2020
…elected in browseMode again.

Fixes regression caused by #10389.
michaelDCurran added a commit that referenced this pull request Mar 11, 2020
* Fix for #10731: cursorManager: ensure that NVDA speaks text being unselected in browseMode again.
Fixes regression caused by #10389.

* Fix linting issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants