Skip to content

Cursor always at the front when first typing some emojis #50563

@shaqima123

Description

@shaqima123

Steps to Reproduce

The cursor often is stuck at the beginning of the TextField when first typing some emojis

Repro:

Open any flutter TextField
Type emoji characters, preferably ones with zero-width-joiners such as 👩‍🚀
Cursor is stuck at front, and tapping in the text works (new text shows up correctly, backspacing works) but the cursor does not appear in the right spot.

this is familiar with the issue #24266 but not the same at all, such as he says the nation flags will cause this problem, but i can't reproduce it.

I have tried many emojis to reproduce, and I found that these emojis would cause the problem,and I printed out the code units to look for the law.

👩‍🚀,[55357, 56425, 8205, 55357, 56960] runes:3,length:5

👩‍❤️‍💋‍👩,[55357, 56425, 8205, 10084, 65039, 8205, 55357, 56459, 8205, 55357, 56425] runes:8,length:11

👨‍👩‍👦‍👦,[55357, 56424, 8205, 55357, 56425, 8205, 55357, 56422, 8205, 55357, 56422] runes:7,length:11
👨🏾‍🤝‍👨🏻,[55357, 56424, 55356, 57342, 8205, 55358, 56605, 8205, 55357, 56424, 55356, 57339] runes:7,length:12

👨‍👦,[55357, 56424, 8205, 55357, 56422] runes:3,length:5

👩‍👦,[55357, 56425, 8205, 55357, 56422] runes:3,length:5

it seems that the emojis which make use of zero width joiners,(code 8205),will easily cause the problem,but not all. I also found that these emojis wont cause the problem,such as:

👩‍❤️‍👨,[55357, 56425, 8205, 10084, 65039, 8205, 55357, 56424] runes:6,length:8
🏌🏿‍♀️,[55356, 57292, 55356, 57343, 8205, 9792, 65039] runes:5,length:7
🏊‍♀️,[55356, 57290, 8205, 9792, 65039] runes:4,length:5
🏄🏻‍♂️,[55356, 57284, 55356, 57339, 8205, 9794, 65039] runes:5,length:7
🇨🇳,[55356, 56808, 55356, 56819] runes:2,length:4

so, what kind of emojis will cause it and why these problem occurs?
Expected results:
expect the cursor can stay at the correct position.
Actual results:
image

Logs

Metadata

Metadata

Assignees

Labels

a: text inputEntering text in a text field or keyboard related problemsc: regressionIt was better in the past than it is nowf: material designflutter/packages/flutter/material repository.found in release: 3.3Found to occur in 3.3found in release: 3.7Found to occur in 3.7frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work on

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions