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

Using keyboard selection in combobox ignores custom text

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: Apache Flex 4.9.0, Apache Flex 4.10.0
    • Fix Version/s: Apache Flex 4.10.0
    • Component/s: Spark: ComboBox
    • Labels:
      None
    • Environment:
      Windows 7, Intel i5, 4GB RAM

      Description

      When using keyboard navigation and selection the spark ComboBox control ignores custom text entered by the user.
      Steps to reproduce:
      Compile and run the following simple application:
      <?xml version="1.0" encoding="utf-8"?>
      <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:mx="library://ns.adobe.com/flex/mx">
      <s:Group>
      <s:layout><s:HorizontalLayout /></s:layout>
      <s:ComboBox id="myCombo" width="200" >
      <s:dataProvider>
      <mx:ArrayList>
      <fx:String>test1</fx:String>
      <fx:String>test2</fx:String>
      <fx:String>test3</fx:String>
      </mx:ArrayList>
      </s:dataProvider>
      </s:ComboBox>
      <s:TextInput id="myText" width="200" />
      </s:Group>
      </s:WindowedApplication>

      Click in the combo box and type "abc"
      Press shift + home

      Actual: The selected text is "test1"
      Expected: The selected text should be "abc"

      I wrote a quick patch for this:
      public class TestComboOverride extends ComboBox
      {
      public function TestComboOverride()

      { super(); }

      override mx_internal function keyDownHandlerHelper(event:KeyboardEvent):void
      {
      if ((event.keyCode == Keyboard.LEFT) || (event.keyCode == Keyboard.RIGHT)

      (event.keyCode == Keyboard.HOME) (event.keyCode == Keyboard.END)) { _proposedSelectedIndex = CUSTOM_SELECTED_ITEM; }

      super.keyDownHandlerHelper(event);
      }
      }
      The problem appears to be that the _proposedSelectedIndex property remains set to -2 [NO_PROPOSED_SELECTION] while entering the text, where it really should have been -3 [CUSTOM_SELECTED_ITEM] unless the user happened to type a label from the data provider in which case it should have the index of that item.
      The DropDownListBase class maintains a "userProposedSelectedIndex" property which appears to overlap in purpose with the proposedSelectedIndex property, but does contain the correct value.

      Unfortunately I have not yet been able to identify the exact place where the value of _proposedSelectedIndex affects the selected item in the given scenario.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              davidb77 david bel
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: