-
-
Notifications
You must be signed in to change notification settings - Fork 650
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
Python 3: when in UIA based edit field, the deleted character is not spoken when pressing backspace #9928
Comments
Can you please test this with a portable copy of normal threshold (not the py3 staging branch)? |
Yes, please give me the time, as i am waiting for compilation.
|
I was not able to reproduce this on latest threshold before Python 3 was merged in. Interesting ehough, I thought it was caused by me changing the postCaretMovedScriptHelper, but that doesn't seem to be the case. |
I am waiting for the mege.
I will see when it merges to threshold
|
Nope,
I’ve testing it now with treshold, and it is not fixed there.
It is a regression
|
Ive been able to look into this some more, and it's pretty complicated. The issue is in editableText.EditableText, line 101: First, let's try to explain something like a code example. For this, type hello into a word document and paste this into a python console:
Output under Python 2 is as follows:
Output under Python 3:
The important case and only difference here is the first occurrence of Cc @feerrenrut |
Another example:
This Compare method on UIA Text Ranges really behaves a bit strange. I'm afraid it is not very safe to rely on it for our equality comparison. |
Is it a showstopper?
@LeonarddeR
|
Somehow yes, but I've already been able to come up with something that fixes it.
|
## Summary of the issue: In text fields, when moving the caret with caret movement commands, such as the arrows, NVDA relies on bookmarks to find out whether the caret has moved. In short: 1. You press left arrow 2. NVDA creates a bookmark of the current caret position 3. NVDA executes left arrow 4. For up to the caret movement timeout, NVDA tries to find out whether the caret has moved by creating new bookmarks and comparing them against the old. However, for UIA, this comparison fails, as creating a bookmark at the end of a range and then removing one character from the end of the range results in a new bookmark that is equal to the former. ## Description of how this fixes the issue: This PR introduces a different approach based on #9773. In first instance, this code caused #9786 to occur (i.e. editors in Chrome reporting the wrong caret position). Compared to #9773, flow is now as follows: - In a loop in EditableText._hasCaretMoved, NVDA processes pedning events - If there is a focus event pending, the loop is exited - NVDA tries to find out whether the caret position has changed by creating a textInfo at the caret position - new code: only when this succeeds, NVDA checks for pending caret and textChange events. If the object that contains the caret has caretMovementDetectionUsesEvents set to False, it still ignores the caret events. This is what we do in IA2Web objects. ## Testing performed: - Tested that deleted characters/words are again reported in UIA controls, such as MS Word - Tested Notepad, Wordpad, Word Without UIA, Thunderbird, LibreOffice, start menu edit field, legacy command consoles and Skype Electron. Made sure that the caret was still correctly reported in all of them when moving with arrow keys or deleting. ## Known issues with pull request: We can't set the caretMovementDetectionUsesEvents attribute to True on editableText.EditableText and then override it in other places, such as IA2Web. This is because EditableText precedes the IA2Web class as well as other classes in the mro Setting it on EditableText directly therefore makes it impossible for other classes to override the attribute. I solved this by making it a magic property on EditableText that first tries to call super before returning the default. Fixes #9928 Follow up of PR #9773
Steps to reproduce:
Actual behavior:
the deleted caracter is not voiced
Expected behavior:
deleted character should be voiced
System configuration
NVDA installed/portable/running from source:
portable
NVDA version:
latest treshold py3 staging
Windows version:
windows 10 1903
Name and version of other software in use when reproducing the issue:
not applicable
Other information about your system:
n/a
Other questions
Does the issue still occur after restarting your PC?
yes
Have you tried any other versions of NVDA? If so, please report their behaviors.
no and not applicable, as it works in alpha snapshots
The text was updated successfully, but these errors were encountered: