fix: Don't clamp character indices when converting a text selection to a range#704
fix: Don't clamp character indices when converting a text selection to a range#704
Conversation
|
This pull request does not fix the bug I found in Vizia. Deleted character sometimes fails to be reported by NVDA when you delete the last character of a text input so that the number of text runs change (e.g. a long line that spanned two lines can now fit on one after deleting the last character). I was also able to reproduce the bug in egui. |
|
@mwcampbell I have added a test that I think shows the problem. The error message is identical to the one I can find in the NVDA logs when deleted character announcement is aborted. |
|
To reproduce manually: use a multiline input such as the one in the egui custom_font example. With this specific example on my setup I can add a space at the end and two more characters. Now repeatedly remove and add back the last character so that the content fit on one line then two. With NVDA you should notice the character announcement being skipped sometimes. Bug appears quite time sensitive, if I add print statements on our codebase, the IO activity is usually enough to make the bug disappear. Despite trying very hard, I could not reproduce this with either JAWS or the built-in Narrator. I'm starting to wonder if NVDA should not guard against that edge case. Chromium does not seem to use weak text ranges and proactively update the text ranges when the tree changes so it does not have this issue. |
In #416 we decided to guard against bad behaving implementations thinking there were no downsides in doing so.
I think we were wrong as any good implementation is now broken when deleting text at the end of a range. This can be observed in NVDA logs:
This possibly explain a bug I described here: vizia/vizia#624
I'll try to submit a fix to egui if we merge this.