Skip to content

UITextField and UITextView don't behave well with some unicode #15

@fweez

Description

@fweez

The updateValue methods in the UITextField and UITextView appear to be tickling a UIKit bug, causing the cursor to unexpectedly jump to the end of the text field while editing.

  1. In the example app, enter some text with a double-width unicode character, such as 🍕 , in the middle. For instance, I entered "Ryan 🍕 Forsythe".
  2. Move the cursor back to the middle of the text. For instance, I moved the cursor to just after the "n" character.
  3. Type any character or hit the backspace
  4. That character appears at the cursor, but then the cursor immediately jumps to the end of the text field.

This repro is for UITextField, but we're seeing the same issue in UITextView. If the whole text field is single-width characters (the ASCII region of unicode works for this) this bug doesn't happen, so I assume this is actually a bug in UIKit. The fix is pretty easy, though. I've forked and made the change, and will send a PR referencing this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions