Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-34173

Cannot move insertion point programmatically in a single-line Spark TextInput using selectRange() when setFocus() is also called

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • Apache Flex 4.12.0
    • None
    • Spark: TextInput
    • None
    • Seen on Mac OS X 10.9; other platforms are probably also affected

    Description

      Calling setFocus() on an unfocused TextInput, followed immediately by selectRange(desiredInsertionPointIndex, desiredInsertionPointIndex) will select the entire text in the RichEditableText.focusInHandler() instead of selecting nothing and moving the insertion point to the desired index.

      This is due to the fact that RichEditableText.selectRange() sets the internal hasProgrammaticSelectionRange flag to true iff the anchor and active positions of the selection are different. I wonder why we cannot simply set hasProgrammaticSelectionRange to true even if the two positions are equal.

      Workaround: setting multiline=true forces the focusInHandler to take a different route and avoid the selectAll() call inside the focusInHandler that alters the selection.

      Attachments

        Activity

          People

            Unassigned Unassigned
            ntamas Tamás Nepusz
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: