-
-
Notifications
You must be signed in to change notification settings - Fork 634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cancellable speech #10885
Cancellable speech #10885
Conversation
CC @LeonarddeR as it can be generalized to include UIA notification handling.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a small walk through this. At first glance, the cancelable speech is indeed pretty related to focus, whereas it could be more generic may be.
Just added a note to the description of this PR:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Firstly this diff was very hard to read with all the refactoring going on. True I could look at commits individually, but I do feel this sort of suggests that refactoring would have been better in a separate pr first if it were truly necessary.
As for the actual changes needed in this pr: if I understand correctly, in simple terms, if a speech utterance was produced due to a gainFocus event, it will contain a cancellableSpeechCommand. This cancellableSpeechCommand will show itself as 'canceled' if the object the event was for was definitly queued as a focus event at some point, and now is not the currently queued focus event. Is my understanding correct?
There are some extra changes to do with focus on this pr, such as the addition of focusInfo and isGainFocusValid. But I cannot see where these are actually ever called... unless NVDA / github are not playing nicely for me...
If they are not called, then they should be obviously removed.
I can confirm that this approach does solve the issue in gmail.
@michaelDCurran Your summary sounds correct to me. I'll clean up those unused functions and split the PR into a refactor + feature. Thanks for reviewing it. |
144f909
to
67c1dff
Compare
This comment has been minimized.
This comment has been minimized.
67c1dff
to
9170e10
Compare
Merge remote-tracking branch 'origin/pr/11049' PR #10885 introduces a way to cancel speech due to focus events that are no longer valid. However, the refactoring commits made the diff hard to view. Some static analysis tools did not understand several classes due to their order in the file. This change re-orders those classes so they are defined before they are used. It also makes that code pass the flake8 checks. The move and restyling are done in separate commits to make revisiting the changes easier. Turning off white space in the diff will also make this easier. - Speech manager changes: - Explicit imports - More typing information added to function definitions. - synthDriverHandler changes: - The order of classes. Now defined before they are used.
This experimental feature can be controlled with a flag in the advanced settings panel. In eventHandler.py keep track of objects that have had focus (on the object, using attribute 'wasGainFocusObj'). This expands on the 'lastQueuedFocusObject' concept. A cancellable speech command is added to speech sequences that result from the focus change event. This command is able to check if the object once had focus ('wasGainFocusObj') and if it still has focus. Speech for objects that no longer have focus can be discarded, or cancelled if already with the synth. Then checking for cancellations is done both early (eventHandler) and late (speech.manager.speak) This requires some careful tracking and processing in speech manager. When nothing is with the synth, try pushing more. Otherwise, there are items in the queue but nothing being spoken. When cancelling synth clear tracking of "with synth" Use _removeCompletedFromQueue rather than _handleIndex _handleIndex may not actually call _removeCompleted. Cancelled speech does need it's callbacks called. For now CancellableSpeechCommand should be considered a private API
9170e10
to
1d146f6
Compare
Refactor for cancellable speech #11049 has now been merged and this PR rebased. It is now ready to be reviewed again. |
This comment has been minimized.
This comment has been minimized.
I think this will probably fix #6421 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't think changes to NVDAObjects\IAccessible\__init__.py
and NVDAObjects\IAccessible\Ia2web.py
are necessary in this pr.
However, I am happy with the rest of it.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Created issue: #11132 I'll look at fixing this early next week. If we can't fix this issue before branching for beta the PR will have to be reverted. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@feerrenrut before creating a new issue, I just wanted to share that enabling this option causes NVDA to skip reporting of window title or tab title when switching with alt+tab or with ctrl+tab. Maybe it is possible to limit the cancelable speech to the elements of the window except for address bars, status bars, notification bars and window titles. |
Note: #11144 |
Lets say, I change focus by some timeout, NVDA is still not cancelling expired focus speech. function getFocus() { Its still reading #myAnchor text and then #myAnchor2 text |
Depends on refactoring in PR #11049, this diff will become easier to follow once that is merged.
Note: this fix is an experimental approach that must be turned on via the 'advanced settings panel' in the NVDA settings dialog.
Link to issue number:
Summary of the issue:
In some web applications (such as Gmail) where user interaction causes rapid focus events NVDA may speak outdated focus information. This can be reproduced in Gmail by quickly moving through email (in focus mode) using the down arrow. Sometimes two or three rows are reported from Gmail.
This issue happens more often in Chrome than in Firefox, but it can be reproduced in both browsers.
Description of how this pull request fixes the issue:
This PR introduces a cancellable speech command, which can be inserted into a speech sequence for speech that may be invalidated (such as due to a new focus event)
Testing performed:
Tested moving through emails (and across table boundaries) in Gmail.
Tested smoke tested web browsing.
Known issues with pull request:
Change log entry:
Changes: