-
-
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
Detect caret movement using events, except for IA2Web #9933
Conversation
|
Caret events are also used for selection if applicable.
May be something like caretMovementUsesCaretEvents or caretMovementUsesEvents.
Backspacing in the start menu has always been problematic for me, particularly because of the suggestions appearing. I will r"look into it though.
|
Apart from the start menu issue, all seems fixed now. I need to investigate that on Master builds though, I'm pretty sure it has never worked very well. |
The code now also listens for textChange events, as they help in the case where text is removed. This fixes the start menu issue for me. |
@feerrenrut: I think it is pretty hard to make sure we have everything right in this pr. THerefore, I propose reviewing and merging it as soon as possible, then patching it afterwards for cases that have problems with this new behavior. |
For a change log entry, how about something like: == Bug Fixes ==
|
UIA consoles are indeed fixed. Start menu says "blank" once when backspacing the last character, then nothing. Ideally it would function like the Windows run dialog and console (i.e. say nothing when all characters have been deleted) but this is still an improvement. |
I don't think anything has improved. It regressed with the use of python
3 and had to be implemented differently. Unless you know a particular
improvement I missed?
|
Current |
Hmm that improves things indeed. The fact that this fails in master makes exactly clear why using bookmarks with UIA is not the reliable way to go.
I'm afraid that NVDA receives a textChange event when pressing backspace the first time. after the field is blank. I will look at this briefly.
|
Once it's fixed, maybe a similar approach can be used for UIA consoles as well? (so we don't have to disable the new approach) |
I think for this to work in UIA consoles, we'd have to distinguish between caret and textChange events.
|
The problem in consoles where the last character of the prompt is reported can also be seen in legacy consoles. This really has to do with events coming in pretty late, i.e. pressing backspace results in an event that is received by NVDA around half a second later. |
After the most recent commit, I could no longer reproduce the issue in consoles and therefore I restored the behavior for UIA consoles. In the start menu search field, it still can be observed, though you'd have to remove text pretty quicly. I don't think there's anything we can use to improve this, as said, events are coming pretty late. |
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.
Thanks @LeonarddeR and @codeofdusk. Overall this looks good, just pending some clarification about the timeout comment.
source/editableText.py
Outdated
else: | ||
# Caret events are unreliable in some controls. | ||
# Only use them if we consider them safe to rely on for a particular control, | ||
# and only if they arrive within 20 mili seconds after causing the event to occur. |
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.
This comment says 20 ms but useEvents_maxTimeoutMs
is 10
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.
Ah, I'm sorry. I first hard coded the 20 ms, but then decided to put it into a constant. Just forgot to change it :)
As of latest |
How about increasing the _useEvents_maxTimeoutMs timeout in editabletext? |
Tried 20, 30, and 40 ms with no success. |
A regression caused during Python 3 migration. NVDA was announcing the final character of the prompt after backspacing text quickly. This can result in NVDA announcing "greater" after backspacing a line of text. Disable caret events in the UIA console and legacy consoles. This PR disables the caret movement event detection from #9933
In Mintty, the last character of the prompt was being read when quickly deleting text, just as in Windows Console (see this comment and the "summary of the issue" section in #9986). This change disables caret events for all Terminal objects by overriding NVDAObjects.behaviors.Terminal._get_caretMovementDetectionUsesEvents, instead of only Windows Console like in #9986. Closes #1348. Related to #9933, #9986.
Link to issue number:
Fixes #9928
Follow up of #9773
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:
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 pull request fixes the issue:
This pr introduces a different approach based on code by @codeofdusk in #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:
caretMovementDetectionUsesEvents
set to False, it still ignores the caret events. This is what we do in IA2Web objects.Testing performed:
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.Change log entry:
None