-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Description
SelectionLength in Entry and Editor is updated correctly if the user selects the text from the left to the right (for example, by pressing the Shift together with the right arrow) However, if the user selects the text in the opposite direction (Shift + left arrow), the reported SelectionLength differs among the platforms. On Android it reports 0 which is incorrect. On Windows, it is the correct non-zero value corresponding to the real selection length.
Example on Android:
Text selected from the left:
Different values for the same selection when it is done from the righ. SelectionLength is reported to be 0, which is incorrect):
Steps to Reproduce
- Clone the reproduction project https://github.com/holecekp/MauiCursorPositionBug
- Run it on Android
- There is a SearchBar, an Entry and an Editor. Type the text "Test" into the Entry in the middle of the page.
- Click on the beginning of the Entry and press Shift+right arrow until you select the whole text. You can see that the Label with the SelectionLength is updated correctly.
- Click on the end of text in the Entry and press Shift+left arrow until you select the whole text. You can see that the SelectionLength is not updated and is 0, which is incorrect.
- You can verify that the same problem is also in the Editor control. You can skip testing this for the SearchBar, which is also on the page, because the SearchBar is completely broken and doesn't work correctly in either direction on Android (already reported as SearchBar - CursorPosition and SelectionLength are not updated when the user types #30779).
- You can verify, that the problem is only on Android and the same app on Windows reports the correct values of CursorPosition and SelectionLength. They are the same regardless in which direction was the text selected. I haven't tested the behavior on iOS and Mac.
Android (the text "Test" selected from left to right) - CursorPosition=0, SelectionLength=4 (correct)
Android (the text "Test" selected from right to left) - CursorPosition=4, SelectionLength=0 (incorrect)
Windows (the text "Test" selected from left to right) - CursorPosition=0, SelectionLength=4 (correct)
Windows (the text "Test" selected from right to left) - CursorPosition=0, SelectionLength=4 (correct)
Link to public reproduction project repository
https://github.com/holecekp/MauiCursorPositionBug
Version with bug
9.0.90 SR9
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 15
Did you find any workaround?
No